home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume26 / xc-4.1 / part01 next >
Encoding:
Text File  |  1993-04-13  |  91.7 KB  |  3,897 lines

  1. Newsgroups: comp.sources.unix
  2. From: jpr@jpr.com (Jean-Pierre Radley)
  3. Subject: v26i150: xc-4.1 - a serial communications program, V4.1, Part01/03
  4. Sender: unix-sources-moderator@vix.com
  5. Approved: paul@vix.com
  6.  
  7. Submitted-By: jpr@jpr.com (Jean-Pierre Radley)
  8. Posting-Number: Volume 26, Issue 150
  9. Archive-Name: xc-4.1/part01
  10.  
  11. [ Note: in spite of its name beginning with an "x", this is not an X11 client.
  12.                                     --vix ]
  13.  
  14.   XC is a communications program for Unix/Xenix.
  15.   It runs either interactively or from scripts (samples included).
  16.   It includes Xmodem capabilities, but it can attach the modem's
  17.        stdin/stdout to standalone Zmodem programs.
  18.   It incorporates CompuServe's B+ Protocol.
  19.   Ascii uploads from disk files; ascii captures to disk files.
  20.   Dialing directory, with pre- and post-session commands for the modem.
  21.   Respects cu/uucp LCK..file conventions.
  22.   Carriage returns are discarded in incoming text, and can optionally
  23.        be inserted for outgoing material or B+ uploads.
  24.   Selectable 7e2, 7o2, or 8n1.
  25.   Selectable XON/XOFF flow control.
  26.   Key-bindings.
  27.  
  28.     jpr@jpr.com (Jean-Pierre Radley)
  29.  
  30. #! /bin/sh
  31. # This is a shell archive.  Remove anything before this line, then unpack
  32. # it by saving it into a file and typing "sh file".  To overwrite existing
  33. # files, type "sh file -c".  You can also feed this as standard input via
  34. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  35. # will see the following message at the end:
  36. #        "End of archive 1 (of 3)."
  37. # Contents:  .aus .autocis .callhq .cisdial .exrc .pass .phonelist .rz
  38. #   .sz .temp_opt .uni .xc Configure Copyright MANIFEST Makefile
  39. #   Makefile.in README bsdinst.sh call callback cisdownload myman
  40. #   xc.h.in xcdbglog.c xcdial.c xcsubs.c xcterm.c
  41. # Wrapped by vixie@gw.home.vix.com on Wed Apr 14 00:22:46 1993
  42. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  43. if test -f '.aus' -a "${1}" != "-c" ; then 
  44.   echo shar: Will not clobber existing file \"'.aus'\"
  45. else
  46. echo shar: Extracting \"'.aus'\" \(1169 characters\)
  47. sed "s/^X//" >'.aus' <<'END_OF_FILE'
  48. X# .asu or .aus : visit SCOForum and UnixForum
  49. X#    non-stop read, and Prompt Char set to '^h' in all Fora.
  50. X#debug "on"
  51. set cis off
  52. set proto 7e2
  53. X
  54. call ".cisdial"
  55. X
  56. pause 3; transmit "^C"
  57. assign SERVICE eq "scoforum"
  58. call ".pass"
  59. X
  60. X#debug "on"
  61. X
  62. set cfile "/pub/jpr/comm/sco"
  63. waitfor "moment please..."
  64. capture "on"
  65. if waitfor "forum !^h"  75
  66. then
  67. X    call ".temp_opt"            
  68. X    assign Upload eq `ls scoR 2>/dev/null`
  69. X    if Upload eq "scoR"
  70. X    then    capture "off"
  71. X        type "scoR"
  72. X        transmit "^M"
  73. X        while ! waitfor "% choice required"
  74. X            do; done
  75. X        shell "mv scoR /pub/rescue/scoR$$"
  76. X        capture "on"
  77. X    fi
  78. X    transmit "rea new^M^M"
  79. X    while ! waitfor "% choice required"
  80. X        do; done
  81. X    capture "off"
  82. else
  83. X    beep
  84. fi
  85. X
  86. set cfile "/pub/jpr/comm/uni"
  87. transmit "g unixforum^M"
  88. waitfor "moment please..."
  89. capture "on"
  90. if waitfor "forum !^h" 75
  91. then
  92. X    call ".temp_opt"            
  93. X    assign Upload eq `ls uniR 2>/dev/null`
  94. X    if Upload eq "uniR"
  95. X    then    capture "off"
  96. X        type "uniR"
  97. X        transmit "^M"
  98. X        while ! waitfor "% choice required"
  99. X            do; done
  100. X        shell "mv uniR /pub/rescue/uniR$$"
  101. X        capture "on"
  102. X    fi
  103. X    transmit "rea new^M^M"
  104. X    while ! waitfor "% choice required"
  105. X        do; done
  106. X    capture "off"
  107. else
  108. X    beep
  109. fi
  110. X
  111. transmit "off^M"
  112. quit
  113. END_OF_FILE
  114. if test 1169 -ne `wc -c <'.aus'`; then
  115.     echo shar: \"'.aus'\" unpacked with wrong size!
  116. fi
  117. # end of '.aus'
  118. fi
  119. if test -f '.autocis' -a "${1}" != "-c" ; then 
  120.   echo shar: Will not clobber existing file \"'.autocis'\"
  121. else
  122. echo shar: Extracting \"'.autocis'\" \(3533 characters\)
  123. sed "s/^X//" >'.autocis' <<'END_OF_FILE'
  124. X# .autocis - xc script to visit CIS automagically.
  125. X# This file uses 4-character tabstops.
  126. X# It will log in, visit CIS Mail (if mail is waiting), then the
  127. X#  PRACTICE and UNIX Fora, uploading any prepared files, downloading
  128. X#  all new messages, and capture them into three separate files.
  129. X
  130. X# The following assumption is made about your CIS interactions:
  131. X#  You are in "expert" mode in MAIL.
  132. X#  You are in Command mode in all Fora.
  133. X#  You have opted for continuous reading in all Fora.
  134. X#  You have set your Prompt Char set to '^H' --backspace-- in all Fora.
  135. X#    This last is VERY critical to the properly trigger the WAITFORs
  136. X
  137. X# This script will call another script, .temp_opt, to set Forum options
  138. X# for only the current login
  139. X
  140. tty "on"        # echo to the tty while script is running (default anyways)
  141. debug "on"        # capture in debug.log providing file pre-exists
  142. set proto 7e2    # CIS is happier
  143. set bps 2400
  144. set cis off        # don't trigger on any stray ENQ character
  145. set xoff on        # set XON/XOFF signalling
  146. X
  147. X#  if linked; then  # this alternate routine calls a
  148. X#    call .cisdial    # sub-script with the dialing information
  149. X#  endif
  150. X
  151. if ! linked; then dial "7662080"; endif    # dial this number
  152. while ! waitfor "CONNECT" 52            # give modem 52 secs to say "CONNECT"
  153. X    do
  154. X        redial
  155. X    done
  156. X
  157. pause 2                        # let network catch up
  158. transmit "^C"                # First thing to send CIS
  159. pause 3                        # let network catch up
  160. X
  161. debug "off"                    # so as not to display the password
  162. X# Now send CIS one string with PPN, first service to go to, and password
  163. transmit "72160,1341/go:mail\\beige*screw^M"
  164. debug "on"
  165. X
  166. if waitfor "CompuServe Mail^M" 8            # we already asked to GO MAIL
  167. then if ! waitfor "No messages pending" 4    # unless nothing waiting, then
  168. X     set cfile "email"                        # use this capture file
  169. X        capture "on"                        # open it
  170. X        file echo `date`                    # time stamp it
  171. X        transmit "rec all^M"                # ask to read everything
  172. X        while ! waitfor "Mail!"                #  until this string appears
  173. X            do; done                        #  script does nothing
  174. X        transmit "del all^M"                # remove msgs from CIS mbox
  175. X        capture "off"                        # close the capture file
  176. X    fi
  177. else
  178. X    beep                            # beep if we never get to CISMail
  179. endif
  180. X
  181. set cfile "pra"                        # new capture file
  182. transmit "g practice^M"                # new Forum
  183. waitfor "moment please..."            # "Welcome" should follow this
  184. capture "on"                        # start appending to 'pra'
  185. if waitfor "forum !^H" 60            # prompt with a backspace
  186. then
  187. X    call ".temp_opt"                # set Forum options for this session.
  188. X    assign Upload eq `ls rp 2>/dev/null`
  189. X    if Upload eq "praR"                # is there a 'praR' file
  190. X    then    capture "off"            # then turn off capturing
  191. X        type "praR"                    # transmit the 'praR' file
  192. X        transmit "^M"                # this extra newline will trigger
  193. X        while ! waitfor "% choice required"    # this response after the upload
  194. X            do; done
  195. X        shell "mv praR /usr/tmp/praR$$"    # rename the 'praR' file
  196. X        capture "on"                # start capturing again
  197. X    fi
  198. X    transmit "rea new^M^M"            # read all new messages
  199. X    while ! waitfor "% choice required"
  200. X        do; done
  201. X    capture "off"
  202. else
  203. X    beep                            # beep if Forum closed, or you get bumped
  204. fi
  205. X
  206. set cfile "uni"                        # same stuff in another Forum
  207. transmit "g unixforum^M"
  208. waitfor "moment please..."
  209. capture "on"
  210. if waitfor "forum !^h" 60
  211. then
  212. X    call ".temp_opt"            
  213. X    assign Upload eq `ls ru 2>/dev/null`
  214. X    if Upload eq "uniR"
  215. X    then    capture "off"
  216. X        type "uniR"
  217. X        transmit "^M"
  218. X        while ! waitfor "% choice required"
  219. X            do; done
  220. X        shell "mv uniR /usr/tmp/uniR$$"
  221. X        capture "on"
  222. X    fi
  223. X    transmit "rea new^M^M"
  224. X    while ! waitfor "% choice required"
  225. X        do; done
  226. X    capture "off"
  227. else
  228. X    beep
  229. fi
  230. X
  231. transmit "off^M"
  232. quit
  233. END_OF_FILE
  234. if test 3533 -ne `wc -c <'.autocis'`; then
  235.     echo shar: \"'.autocis'\" unpacked with wrong size!
  236. fi
  237. # end of '.autocis'
  238. fi
  239. if test -f '.callhq' -a "${1}" != "-c" ; then 
  240.   echo shar: Will not clobber existing file \"'.callhq'\"
  241. else
  242. echo shar: Extracting \"'.callhq'\" \(849 characters\)
  243. sed "s/^X//" >'.callhq' <<'END_OF_FILE'
  244. X# .callhq
  245. X# script to call and login to a Unix/Xenix system that
  246. X# needs BREAK signals to switch bps rates
  247. X
  248. X    debug "on"        # turn on verbose script reporting
  249. X    tty "on"        # echo received characters to screen
  250. X    set bps 9600 ;     # extraneous semicolons don't matter
  251. X
  252. X    #dial, if we haven't already from the dial directory
  253. X    if ! linked        # note the space after the "!"
  254. X    then
  255. X        dial "2127874639"
  256. X    endif
  257. X
  258. X    while ! waitfor "CONNECT" 40        # redial forever
  259. X    do
  260. X        redial
  261. X    done
  262. X
  263. X    # try five times to get a login prompt
  264. X    assign counter eq 5
  265. X    while ! waitfor "login:" 10
  266. X    do
  267. X        decr counter; if counter lessthan 1; then quit; fi
  268. X        xmitbrk                # send a BREAK signal
  269. X    done
  270. X
  271. X    # now connected, at login prompt
  272. X    beep                    # just a personal touch
  273. X    pause 3
  274. X    transmit "username^M"
  275. X    waitfor "word:" 5
  276. X    debug "off"
  277. X    transmit "password^M"
  278. X    debug "on"
  279. X    exit                    # out to terminal mode
  280. END_OF_FILE
  281. if test 849 -ne `wc -c <'.callhq'`; then
  282.     echo shar: \"'.callhq'\" unpacked with wrong size!
  283. fi
  284. # end of '.callhq'
  285. fi
  286. if test -f '.cisdial' -a "${1}" != "-c" ; then 
  287.   echo shar: Will not clobber existing file \"'.cisdial'\"
  288. else
  289. echo shar: Extracting \"'.cisdial'\" \(453 characters\)
  290. sed "s/^X//" >'.cisdial' <<'END_OF_FILE'
  291. X# .cisdial - a script to dial CIS on different modems and log in.
  292. X
  293. assign modem eq portname
  294. if ! linked
  295. then    
  296. X    if    modem eq "/dev/ttyA01"
  297. X    then    transmit "ATs0=0 &K2^M"
  298. X        pause 1
  299. X        dial "7662080"
  300. X    fi
  301. X    if    modem eq "/dev/ttyA02"
  302. X        modem eq "/dev/ttyA03"
  303. X    then    transmit "ATs0=0 s58=3^M"
  304. X        pause 1
  305. X        dial "7662080"
  306. X    fi
  307. X    if    modem eq "/dev/tty1A"
  308. X    then    transmit "ATs0=0 s50=3^M"
  309. X        pause 1
  310. X        dial "6086021"
  311. X    fi
  312. fi
  313. X
  314. while ! waitfor "CONNECT" 52; do; redial; done
  315. END_OF_FILE
  316. if test 453 -ne `wc -c <'.cisdial'`; then
  317.     echo shar: \"'.cisdial'\" unpacked with wrong size!
  318. fi
  319. # end of '.cisdial'
  320. fi
  321. if test -f '.exrc' -a "${1}" != "-c" ; then 
  322.   echo shar: Will not clobber existing file \"'.exrc'\"
  323. else
  324. echo shar: Extracting \"'.exrc'\" \(812 characters\)
  325. sed "s/^X//" >'.exrc' <<'END_OF_FILE'
  326. X" the leading '"' makes this line a comment
  327. X" uncomment lines by removing the leading '"'
  328. X"
  329. X" tab settings for all XC source files 
  330. set ts=4 sw=4
  331. X"
  332. X" macros for handling CompuServe downloads
  333. X" make sure the ^M below are true Ctrl-M
  334. X" make sure the ^[ below are true ESCAPE
  335. X"
  336. X" set wm=1 
  337. X"
  338. X" F5 squeezes out empty lines, marks new setion with 'm'
  339. X" map    #5    /^welcome to /
  340. --mm/^Forum !\/
  341. d`mSmm
  342. :.,$g/^ *$/d
  343. 'm
  344. X"
  345. X" F2 deletes from current line to mark 'm', and leaves a new mark 'm'
  346. X" map    #2    d`mSmmz
  347. X"
  348. X" with cursor within a message, F1 sets up for a reply
  349. X" map    #1    ?^#: \([1-9][0-9]*\) .*S[0-9]*/.*?
  350. Y/
  351. 
  352. X" map        P:s;;re\1;
  353. mao/post unfmbO
  354. X"
  355. X" ^X takes a reply prepared after an F1, and appends it to an upload file
  356. X" map        'aO:'a,'b w>>%R
  357. :'a,'b d
  358. X"
  359. X" F8 places next message at top of screen
  360. X" map    #8    /#:/z
  361. END_OF_FILE
  362. echo shar: 8 control characters may be missing from \"'.exrc'\"
  363. if test 812 -ne `wc -c <'.exrc'`; then
  364.     echo shar: \"'.exrc'\" unpacked with wrong size!
  365. fi
  366. # end of '.exrc'
  367. fi
  368. if test -f '.pass' -a "${1}" != "-c" ; then 
  369.   echo shar: Will not clobber existing file \"'.pass'\"
  370. else
  371. echo shar: Extracting \"'.pass'\" \(833 characters\)
  372. sed "s/^X//" >'.pass' <<'END_OF_FILE'
  373. X#.pass   This script should be protected, it has all your passwords!
  374. X
  375. debug "off"    # prevent screen echoing of the password!
  376. pause 2
  377. X
  378. if SERVICE eq "unixforum"
  379. then
  380. X    set cfile "uni"
  381. X    #set auto "on"
  382. X    set cis "on"
  383. X    transmit "72160.1341/go:unixforum\\harsh#words^M"
  384. X    exit
  385. fi
  386. X
  387. if SERVICE eq "scoforum"
  388. then
  389. X    set cfile "sco"
  390. X    #set auto "on"
  391. X    set cis "on"
  392. X    transmit "72160.1341/go:scoforum\\harsh#words^M"
  393. X    exit
  394. fi
  395. X
  396. if SERVICE eq "mail"
  397. then
  398. X    set cfile "email"
  399. X    #set auto "on"
  400. X    set cis "off"
  401. X    transmit "72160.1341/go:mail\\harsh#words^M"
  402. X    exit
  403. fi
  404. X
  405. if SERVICE eq "cis"
  406. then
  407. X    set cfile "cis"
  408. X    #set auto "on"
  409. X    set cis "off"
  410. X    transmit "72160.1341\\harsh#words^M"
  411. X    exit
  412. fi
  413. X
  414. if SERVICE eq "jpr"
  415. then
  416. X    transmit "jpr^M"
  417. X    waitfor "word:"
  418. X    transmit "enTHuse^M"
  419. fi
  420. X
  421. if SERVICE eq "root"
  422. then
  423. X    transmit "root^M"
  424. X    waitfor "word:"
  425. X    transmit "up&down"
  426. fi
  427. END_OF_FILE
  428. if test 833 -ne `wc -c <'.pass'`; then
  429.     echo shar: \"'.pass'\" unpacked with wrong size!
  430. fi
  431. # end of '.pass'
  432. fi
  433. if test -f '.phonelist' -a "${1}" != "-c" ; then 
  434.   echo shar: Will not clobber existing file \"'.phonelist'\"
  435. else
  436. echo shar: Extracting \"'.phonelist'\" \(1221 characters\)
  437. sed "s/^X//" >'.phonelist' <<'END_OF_FILE'
  438. X766-2080 AutoLogin CompuServe    SCRIPT=.aus PROTO=8n1 BPS=57600 PREFIX=ats0=0s50=6
  439. X766-2080 AutoLogin CompuServe    SCRIPT=.autocis PROTO=8n1 BPS=57600 PREFIX=ats0=0s250=6
  440. X766-2080 9600 CompuServe PM9600    PROTO=8n1 BPS=38400 PREFIX=ATs0=0&K2
  441. X766-2080 9600 CompuServe T3000    PROTO=8n1 BPS=57600 PREFIX=ATs0=0s50=6
  442. X608-6021 2400 CompuServe    SCRIPT=.autocis PROTO=7e2 BPS=2400 PREFIX=ATs0s50=3
  443. X608-6021 2400 CompuServe    SCRIPT=.uni PROTO=7e2 BPS=2400 PREFIX=ATs0s50=3
  444. X1-718-335-8784 The Wall-2    PROTO=8n1 BPS=2400 #CHARCOAL
  445. X675-8438 marob/tb    PROTO=8n1 BPS=19200 SCRIPT=.marob PREFIX=ats111=20s110=1s50=255
  446. X675-7059 marob/24    PROTO=8n1 BPS=2400 SCRIPT=.marob24
  447. X677-9487 magpie    PROTO=8n1 BPS=19200 PREFIX=ats110=0s111=0
  448. X529-0498 pcsi    PROTO=8n1 BPS=2400 SCRIPT=.pcsi
  449. X769-0550 nycenet    PROTO=8n1 BPS=2400
  450. X924-4352    Chelsea Square Magpie    PROTO=8n1 BPS=2400
  451. X473-2744    CSig BBS        PROTO=8n1 BPS=2400
  452. X781-4723    Friends!        PROTO=8n1 BPS=2400
  453. X764-3834    Mofo    PROTO=7e2 BPS=1200    # CR, CR
  454. X1-401-351-1465    Macintosh Tree        PROTO=8n1 BPS=2400
  455. X1-408-378-6745    Doug Stein's Magpie    PROTO=8n1 BPS=2400
  456. X10444-1-516-536-8723    Sound of Music        PROTO=8n1 BPS=2400
  457. X1-503-621-3746    Telegodzilla        PROTO=8n1 BPS=2400
  458. X749-8427    INFO BROKER - GO    PROTO=8n1 BPS=2400 PREFIX=ATs0=0
  459. END_OF_FILE
  460. if test 1221 -ne `wc -c <'.phonelist'`; then
  461.     echo shar: \"'.phonelist'\" unpacked with wrong size!
  462. fi
  463. # end of '.phonelist'
  464. fi
  465. if test -f '.rz' -a "${1}" != "-c" ; then 
  466.   echo shar: Will not clobber existing file \"'.rz'\"
  467. else
  468. echo shar: Extracting \"'.rz'\" \(152 characters\)
  469. sed "s/^X//" >'.rz' <<'END_OF_FILE'
  470. echo -n "What files are to be received? "
  471. read FILES
  472. transmit "sz -y "
  473. transmit FILES
  474. transmit "^M"
  475. echo "Starting ZMODEM Receive (rz -y)"
  476. pipe "rz -y"
  477. END_OF_FILE
  478. if test 152 -ne `wc -c <'.rz'`; then
  479.     echo shar: \"'.rz'\" unpacked with wrong size!
  480. fi
  481. # end of '.rz'
  482. fi
  483. if test -f '.sz' -a "${1}" != "-c" ; then 
  484.   echo shar: Will not clobber existing file \"'.sz'\"
  485. else
  486. echo shar: Extracting \"'.sz'\" \(115 characters\)
  487. sed "s/^X//" >'.sz' <<'END_OF_FILE'
  488. echo -n "What files are to be sent? "
  489. read FILES
  490. echo "Starting ZMODEM send (sz -y " FILES ")"
  491. pipe "sz -y " FILES
  492. END_OF_FILE
  493. if test 115 -ne `wc -c <'.sz'`; then
  494.     echo shar: \"'.sz'\" unpacked with wrong size!
  495. fi
  496. # end of '.sz'
  497. fi
  498. if test -f '.temp_opt' -a "${1}" != "-c" ; then 
  499.   echo shar: Will not clobber existing file \"'.temp_opt'\"
  500. else
  501. echo shar: Extracting \"'.temp_opt'\" \(459 characters\)
  502. sed "s/^X//" >'.temp_opt' <<'END_OF_FILE'
  503. X# .temp_opt     set CIS options for auto-scripts.
  504. capture "off"
  505. transmit "opt;"
  506. transmit "1;1;"        # Forum first
  507. transmit "2;3;"        # command mode
  508. transmit "3;N;"        # never stop
  509. transmit "6;2;"        # editor
  510. transmit "9;N;"        # no info. on replies
  511. transmit "10;N;"     # no waiting messages
  512. transmit "11;N;"    # no skip own messages
  513. transmit "5^M"
  514. waitfor "prompt: "
  515. transmit "\^H^M"    # set prompt to Ctrl-H
  516. waitfor "choice !"
  517. transmit "T^MS^M"    # [T]op ; [S]ession
  518. capture "on"
  519. END_OF_FILE
  520. if test 459 -ne `wc -c <'.temp_opt'`; then
  521.     echo shar: \"'.temp_opt'\" unpacked with wrong size!
  522. fi
  523. # end of '.temp_opt'
  524. fi
  525. if test -f '.uni' -a "${1}" != "-c" ; then 
  526.   echo shar: Will not clobber existing file \"'.uni'\"
  527. else
  528. echo shar: Extracting \"'.uni'\" \(1290 characters\)
  529. sed "s/^X//" >'.uni' <<'END_OF_FILE'
  530. X#.uni
  531. X# sample script to call CompuServe, go to the UnixForum,
  532. X# and enter terminal mode
  533. X
  534. X    debug "on"        # turn on verbose script reporting
  535. X    tty "on"        # echo received characters to screen
  536. X    set bps 2400    # numbers don't need literal quotes
  537. X    set proto 7E2    # CIS is happier
  538. X
  539. X    if ! linked; then        # dial if we haven't already
  540. X        dial "9687790"
  541. X    endif
  542. X
  543. X    while ! waitfor "CONNECT" 35    # redial forever
  544. X    do
  545. X        redial
  546. X    done
  547. X
  548. X    pause 2                # wait for network to catch up
  549. X
  550. X    # wait for a "User ID" prompt, but put a cap on how long
  551. X    transmit "^C"
  552. X    assign counter eq 1
  553. X    while ! waitfor " ID" 20
  554. X    do
  555. X        incr counter
  556. X        if counter morethan 5; then quit; endif
  557. X        transmit "^C"
  558. X    done
  559. X
  560. X    pause 2                # wait for network to catch up
  561. X    transmit "72160,1341^M"        # send user ID number (PPN)
  562. X
  563. X    # if no "Password:" prompt in 20 seconds, bomb out
  564. X    if ! waitfor "word" 20 ; then quit; endif
  565. X
  566. X    debug "off"            # password protection
  567. X    pause 1; transmit "My*Password^M"
  568. X    debug "on"
  569. X
  570. X    waitfor "!" 20
  571. X
  572. X    transmit "g unixfo^M"
  573. X
  574. X    # if we don't see "Welcome", we're not in the Forum
  575. X    if ! waitfor "Welcome" 20
  576. X    then                # <- NEVER forget the "then"!
  577. X        transmit "bye^M"
  578. X        quit            # this is total program death
  579. X    else
  580. X        beep            # just a personal touch
  581. X    endif
  582. X
  583. X    set cis on            # enable auto-startup of CIS B+ transfers
  584. X
  585. X    exit                # enter terminal mode
  586. END_OF_FILE
  587. if test 1290 -ne `wc -c <'.uni'`; then
  588.     echo shar: \"'.uni'\" unpacked with wrong size!
  589. fi
  590. # end of '.uni'
  591. fi
  592. if test -f '.xc' -a "${1}" != "-c" ; then 
  593.   echo shar: Will not clobber existing file \"'.xc'\"
  594. else
  595. echo shar: Extracting \"'.xc'\" \(1284 characters\)
  596. sed "s/^X//" >'.xc' <<'END_OF_FILE'
  597. X# .xc -- startup script
  598. set bps 57600
  599. set cis off
  600. set proto 8N1
  601. set cr on
  602. set nl on
  603. set xoff on
  604. set hdplx off
  605. set menu on
  606. set auto on
  607. set XCAPE 
  608. X
  609. X#assign modem eq portname
  610. X# setting different default speeds for assorted modems
  611. X# note that the following means: if ANY of the three conditions are met
  612. if modem eq "/dev/ttyA01"; modem eq "/dev/ttyA02"; modem eq "/dev/ttyA03" ; modem eq "/dev/ttyA08"
  613. then
  614. X    set bps 38400
  615. else
  616. X    set bps 2400
  617. endif
  618. X
  619. X#####
  620. X# Dynamic keyboard binding feature
  621. X#####
  622. X
  623. X# Set terminal mode escape character ("XCAPE") to Control-Z:
  624. X# set escape ^Z
  625. X
  626. X# Bind XCAPE-0 to set Telebit T2500 to not require MNP:
  627. bind_string "AAAAT S95=0^M" 48
  628. X
  629. X# Bind XCAPE-1 to set Telebit T2500 to attempt LAP/M and then MNP:
  630. bind_string 49 "AAAAT S95=1 S96=1 S97=1 S98=3 S106=0^M"
  631. X
  632. X# Bind XCAPE-^S to receive a file using sz (.sz included in distribution)
  633. bind_script 19 "/usr/lib/xc/.sz"
  634. X
  635. X# Bind XCAPE-^R to receive a file using rz (.rz included in distribution)
  636. bind_script 18 "/usr/lib/xc/.rz"
  637. X
  638. X# Bind XCAPE-^Z to exit out of XC (a la vi).  Note that this is dangerous
  639. X# because you no longer have a way of emitting a XCAPE through the modem,
  640. X# except by embedding the command into a "bind_string" or "bind_script".
  641. X# It's still a neat exit command...
  642. X
  643. bind_function 26 "quitchr"
  644. END_OF_FILE
  645. echo shar: 1 control character may be missing from \"'.xc'\"
  646. if test 1284 -ne `wc -c <'.xc'`; then
  647.     echo shar: \"'.xc'\" unpacked with wrong size!
  648. fi
  649. # end of '.xc'
  650. fi
  651. if test -f 'Configure' -a "${1}" != "-c" ; then 
  652.   echo shar: Will not clobber existing file \"'Configure'\"
  653. else
  654. echo shar: Extracting \"'Configure'\" \(8960 characters\)
  655. sed "s/^X//" >'Configure' <<'END_OF_FILE'
  656. X#! /bin/sh
  657. X
  658. trap "rm -f tmp*; exit 0" 0
  659. trap "rm -f tmp*; exit 1" 1 2 3 15
  660. X
  661. die()
  662. X{
  663. X    echo "$*"
  664. X    exit 1
  665. X}
  666. X
  667. yorn()
  668. X{
  669. X    while :
  670. X    do
  671. X        read ans
  672. X
  673. X    case "${ans:-$1}" in
  674. X    [Yy]*)    return 0
  675. X        ;;
  676. X    [Nn]*)    return 1
  677. X        ;;
  678. X    *)    nonl "Please respond 'Y' or 'N': "
  679. X        ;;
  680. X    esac
  681. X    done
  682. X}
  683. X
  684. find_exe()
  685. X{
  686. for i in `echo $PATH |
  687. X      sed -e 's/^:/.:/' \
  688. X          -e 's/::/:.:/g' \
  689. X          -e 's/:$/:./' \
  690. X          -e 's/:/ /g`
  691. do
  692. X    if [ -x "$i/$1" ]
  693. X    then
  694. X        return 0
  695. X    fi
  696. done
  697. return 1
  698. X}
  699. X
  700. case `echo -n` in
  701. X-n)    nonl() { echo "$*\c"; };;
  702. X*)    nonl() { echo -n "$*"; };;
  703. esac
  704. X
  705. echo
  706. echo "XC Configuration Utility -- written by lar3ry gensch, ESQ"
  707. echo
  708. echo "When a default answer is suggested [in brackets],"
  709. echo "you may accept it by just hitting <ENTER>."
  710. echo
  711. X
  712. need_answers=true
  713. X
  714. if [ -f configure.out ]
  715. then
  716. X    echo "Configure has already been run."
  717. X    nonl "Do you wish to use the previous results? (Y/N) [N]: "
  718. X    if yorn N
  719. X    then
  720. X        . ./configure.out
  721. X        need_answers=false
  722. X    fi
  723. fi
  724. X
  725. if $need_answers
  726. then
  727. X    UUCPLIBDIR=/usr/lib/uucp
  728. X
  729. X    if [ ! -d "$UUCPLIBDIR" ]
  730. X    then
  731. X        echo "*** Warning:  Cannot determine UUCP lib directory"
  732. X        echo "***           Using $UUCPLIBDIR"
  733. X        echo
  734. X    fi
  735. X
  736. X    if [ -f $UUCPLIBDIR/ungetty -a -f /xenix ]
  737. X    then
  738. X        DIDO="2"    
  739. X    elif [ -d /var/spool/locks -a -f /usr/include/sys/mkdev.h ]
  740. X    then
  741. X        DIDO="4"
  742. X    elif [ -f /unix ]
  743. X    then
  744. X        DIDO="3"
  745. X    else
  746. X        DIDO="0"
  747. X    fi
  748. X
  749. X    echo
  750. X    echo "Determining compile environment..."
  751. X
  752. X    CC=""
  753. X    COPTS=""
  754. X
  755. X    while :
  756. X    do
  757. X        if find_exe gcc
  758. X        then
  759. X            CC=gcc
  760. X            COPTS="-O2"
  761. X        elif find_exe cc
  762. X        then
  763. X            CC=cc
  764. X            COPTS="-O"
  765. X        else
  766. X            CC=""
  767. X        fi
  768. X
  769. X        nonl "C compiler to use [${CC}]: "
  770. X        read cc
  771. X
  772. X        [ -n "$cc" ] && CC="$cc"
  773. X
  774. X        if find_exe $CC
  775. X        then
  776. X           break
  777. X        fi
  778. X    done
  779. X
  780. X    echo
  781. X    echo "C Compiler is $CC"
  782. X
  783. X    default="$COPTS"
  784. X    while :
  785. X    do
  786. X        echo
  787. X        nonl "Enter compiler options [$default]: "
  788. X        read ans
  789. X
  790. X        [ -n "$ans" ] && COPTS="$ans"
  791. X
  792. X        echo "main() { }" >tmp.c
  793. X        $CC $COPTS tmp.c -o tmp >/dev/null 2>&1 && break
  794. X
  795. X        echo "Those options don't seem quite right... try again."
  796. X    done
  797. X
  798. X    echo
  799. X    echo "Determining where to find screen control functions..."
  800. X
  801. X    echo "main() { tgetent(); }" >tmp.c
  802. X    for LDFLAGS in -ltermcap -ltinfo -lcurses ""
  803. X    do
  804. X        $CC tmp.c -o tmp $LDFLAGS >/dev/null 2>&1 && break
  805. X    done
  806. X        
  807. X    if [ ! $LDFLAGS ]
  808. X    then
  809. X        echo
  810. X        echo "*** We tried -ltermcap, -ltinfo, and -lcurses without success."
  811. X        while :
  812. X        do
  813. X            nonl "Enter a '-lLIB' option for a screen control library: "
  814. X            read LDFLAGS
  815. X
  816. X            $CC tmp.c -o tmp $LDFLAGS >/dev/null 2>&1 && break
  817. X
  818. X            echo "That isn't finding the tgetent() function... try again."
  819. X            echo
  820. X        done
  821. X    fi
  822. X
  823. X    if [ -f /lib/libc_s.a -o -f /usr/lib/libc_s.a ]
  824. X    then
  825. X        LDFLAGS="$LDFLAGS -lc_s"
  826. X    fi
  827. X
  828. X    echo
  829. X    echo "LDFLAGS = $LDFLAGS"
  830. X
  831. X    echo
  832. X    echo "Checking run time library for functions..."
  833. X
  834. X    eval `for i in "dup2(i,j)" \
  835. X           "memset(s,c,i)" \
  836. X           "strchr(s,c)" \
  837. X           "strrchr(s,c)" \
  838. X           "strdup(s)" \
  839. X           "strstr(s,t)"
  840. X    do
  841. X        funct=\`echo "$i" | sed 's/(.*$//'\`
  842. X
  843. X        cat >tmp.c <<!
  844. int i,j;
  845. char *s,*t;
  846. char c;
  847. main() { $i; }
  848. X!
  849. X
  850. X        $CC $COPTS -o tmp tmp.c $LDFLAGS >/dev/null 2>&1 || rm -f tmp
  851. X        if [ -f tmp ]
  852. X        then
  853. X            val="1"
  854. X            echo "    $funct was found" 1>&2
  855. X        else
  856. X            val="0"
  857. X            echo "    $funct was not found" 1>&2
  858. X        fi
  859. X
  860. X        rm -f tmp*
  861. X        echo "have_${funct}=$val"
  862. X    done`
  863. X
  864. X    echo
  865. X    echo "Checking <sys/types.h> for typedefs..."
  866. X
  867. X    eval `for i in pid_t ulong unchar ushort
  868. X    do
  869. X        if [ ! -f /usr/include/sys/types.h ]
  870. X        then
  871. X            echo "have_$i=false"
  872. X            continue
  873. X        fi
  874. X
  875. X        cat >tmp.c <<!
  876. X#include <sys/types.h>
  877. X$i foo;
  878. X!
  879. X
  880. X        $CC $COPTS -c tmp.c >/dev/null 2>&1
  881. X        if [ -f tmp.o ]
  882. X        then
  883. X            val=1
  884. X            echo "    $i was found" 1>&2
  885. X        else
  886. X            val=0
  887. X            echo "    $i was not found" 1>&2
  888. X        fi
  889. X
  890. X        echo "have_$i=$val"
  891. X        rm -f tmp*
  892. X    done`
  893. X
  894. X    echo
  895. X    echo "XC Local Configuration Section"
  896. X
  897. X    while :
  898. X    do
  899. X        nonl "Enter user name to own xc [uucp]: "
  900. X
  901. X        read ans
  902. X
  903. X        OWNER="${ans:-uucp}"
  904. X
  905. X        case "$OWNER" in
  906. X        *:*)    echo "Invalid user name"
  907. X            ;;
  908. X        *)    grep "^${OWNER}:" /etc/passwd >/dev/null 2>&1 && break
  909. X            echo "User $OWNER not found in /etc/passwd"
  910. X            ;;
  911. X        esac
  912. X    done
  913. X
  914. X    while :
  915. X    do
  916. X        nonl "Enter group name to own xc [uucp]: "
  917. X
  918. X        read ans
  919. X
  920. X        GROUP="${ans:-uucp}"
  921. X
  922. X        case "$GROUP" in
  923. X        *:*)    echo "Invalid group name"
  924. X            ;;
  925. X        *)    grep "^${GROUP}:" /etc/group >/dev/null 2>&1 && break
  926. X            echo "Group $GROUP not found in /etc/group"
  927. X        ;;
  928. X        esac
  929. X    done
  930. X
  931. X    while :
  932. X    do
  933. X        nonl "Enter permissions for xc executable [4755]: "
  934. X
  935. X        read ans
  936. X
  937. X        BINMODE="${ans:-4755}"
  938. X
  939. X        case "$BINMODE" in
  940. X        [0-1][0-7][0-7][0-7]|[0-7][0-7][0-7])
  941. X            echo "*** Warning permissions are not SUID or SGID"
  942. X            INSTALL="install"
  943. X            break
  944. X            ;;
  945. X
  946. X        [2-7][0-7][0-7][0-7])
  947. X            INSTALL="install.suid"
  948. X            INSTPREF="su to 'root', and then "
  949. X            break
  950. X            ;;
  951. X        *)    echo "Invalid permissions"
  952. X            ;;
  953. X        esac
  954. X    done
  955. X
  956. X    echo
  957. X
  958. X    MDIR=""
  959. X    MANDIR=""
  960. X    MANEXT=""
  961. X
  962. X    for i in /usr/local/man /usr/catman /usr/man
  963. X    do
  964. X        if [ -d "$i" ]
  965. X    then
  966. X        MANDIR=$i
  967. X        break
  968. X    fi
  969. X    done
  970. X
  971. X    if [ -z "$MANDIR" ]
  972. X    then
  973. X        echo "*** Warning:  Cannot determine MANDIR"
  974. X        echo "              Using /usr/man/mann"
  975. X        MANDIR=/usr/man
  976. X        MDIR=mann
  977. X        MANEXT=n
  978. X    else
  979. X        eval `for i in cat man
  980. X        do
  981. X            for j in n l 1 L LOCAL
  982. X            do
  983. X                dir=${i}${j}
  984. X                if [ -d "$MANDIR/$dir" ]
  985. X                then
  986. X                    echo MDIR=$dir
  987. X                    echo MANEXT=$j
  988. X                    break 2
  989. X                fi
  990. X                dir=${i}.${j}
  991. X                if [ -d "$MANDIR/$dir" ]
  992. X                then
  993. X                    echo MDIR=$dir
  994. X                    echo MANEXT=$j
  995. X                    break 2
  996. X                fi
  997. X            done
  998. X        done`
  999. X
  1000. X        if [ -z "$MDIR" ]
  1001. X        then
  1002. X            echo "*** Warning: Could not locate online man pages"
  1003. X            MDIR=mann
  1004. X            MANEXT=n
  1005. X        fi
  1006. X    fi
  1007. X
  1008. X    echo "Using MANDIR $MANDIR/$MDIR ..."
  1009. X    echo
  1010. X
  1011. X    case "$MDIR" in
  1012. X    cat*)    CATMAN=true
  1013. X        ;;
  1014. X    *)        CATMAN=false
  1015. X        ;;
  1016. X    esac
  1017. X
  1018. X    default=""
  1019. X    for i in /usr/local/bin /pub/bin /usr/lbin /usr/bin/local /u/bin
  1020. X    do
  1021. X        if [ -d "$i" ]
  1022. X        then
  1023. X            default="$i"
  1024. X            break
  1025. X        fi
  1026. X    done
  1027. X
  1028. X    while :
  1029. X    do
  1030. X        nonl "Enter installation directory [$default]: "
  1031. X        read ans
  1032. X
  1033. X        INSDIR="${ans:-$default}"
  1034. X
  1035. X        case "$INSDIR" in
  1036. X        /*)    [ -d "$INSDIR" ] && break
  1037. X            echo "Directory $ans was not found"
  1038. X            ;;
  1039. X        *)    echo "Directory $ans is not an absolute path"
  1040. X            ;;
  1041. X        esac
  1042. X    done
  1043. X
  1044. X    echo
  1045. X    nonl "Do you wish to add DEBUG code into XC? (Y/N) [Y]: "
  1046. X    if yorn Y
  1047. X    then
  1048. X        DEBUG="1"
  1049. X    else
  1050. X        DEBUG="0"
  1051. X    fi
  1052. X
  1053. X    echo
  1054. X    nonl "Do you wish to disallow shell escapes? (Y/N) [N]: "
  1055. X
  1056. X    if yorn N
  1057. X    then
  1058. X        NOSHELL="1"
  1059. X    else
  1060. X        NOSHELL="0"
  1061. X    fi
  1062. X
  1063. X    echo
  1064. X    nonl "Does dropping carrier cause your modem to hang up? (Y/N) [Y]: "
  1065. X
  1066. X    if yorn Y
  1067. X    then
  1068. X        DTR_DROPS_CARRIER="1"
  1069. X    else
  1070. X        DTR_DROPS_CARRIER="0"
  1071. X    fi
  1072. X
  1073. X    default=""
  1074. X    for i in /usr/local/lib /usr/lib/local /usr/lib /u/lib
  1075. X    do
  1076. X        if [ -d "$i" ]
  1077. X    then
  1078. X        default="$i/xc"
  1079. X        break
  1080. X    fi
  1081. X    done
  1082. X
  1083. X    echo
  1084. X    while :
  1085. X    do
  1086. X        nonl "Enter default XC data file directory [$default]: "
  1087. X
  1088. X        read ans
  1089. X
  1090. X        LIBDIR=${ans:-$default}
  1091. X
  1092. X        case "$LIBDIR" in
  1093. X        /*)    [ -d "$LIBDIR" ] && break
  1094. X            parent=`dirname $LIBDIR`
  1095. X            [ -d "$parent" -a ! -f $LIBDIR ] && break
  1096. X            if [ -d "$parent" ]
  1097. X            then
  1098. X                echo "$LIBDIR is not a directory"
  1099. X            else
  1100. X                echo "Parent directory $parent not found"
  1101. X            fi
  1102. X            ;;
  1103. X        *)    echo "Directory $LIBDIR is not an absolute path"
  1104. X            ;;
  1105. X        esac
  1106. X    done
  1107. X
  1108. X    DATE=`date`
  1109. X    USER=`id | sed -e 's/[^(]*(//' -e s'/).*$//'`
  1110. X
  1111. X    cat >./configure.out <<!
  1112. BINMODE="$BINMODE"
  1113. CATMAN="$CATMAN"
  1114. CC="$CC"
  1115. COPTS="$COPTS"
  1116. DATE="$DATE"
  1117. DEBUG="$DEBUG"
  1118. DIDO="$DIDO"
  1119. DTR_DROPS_CARRIER="$DTR_DROPS_CARRIER"
  1120. GROUP="$GROUP"
  1121. have_dup2="$have_dup2"
  1122. have_memset="$have_memset"
  1123. have_pid_t="$have_pid_t"
  1124. have_strchr="$have_strchr"
  1125. have_strdup="$have_strdup"
  1126. have_strrchr="$have_strrchr"
  1127. have_strstr="$have_strstr"
  1128. have_ulong="$have_ulong"
  1129. have_unchar="$have_unchar"
  1130. have_ushort="$have_ushort"
  1131. INSDIR="$INSDIR"
  1132. INSTALL="$INSTALL"
  1133. INSTPREF="$INSTPREF"
  1134. LDFLAGS="$LDFLAGS"
  1135. LIBDIR="$LIBDIR"
  1136. MANDIR="$MANDIR"
  1137. MANEXT="$MANEXT"
  1138. MDIR="$MDIR"
  1139. NOSHELL="$NOSHELL"
  1140. OWNER="$OWNER"
  1141. USER="$USER"
  1142. X!
  1143. fi
  1144. X
  1145. set -e
  1146. X
  1147. echo
  1148. echo "Creating xc.h ..."
  1149. X
  1150. sed "
  1151. s;{{DATE}};$DATE;g
  1152. s;{{DEBUG}};$DEBUG;g
  1153. s;{{DIDO}};$DIDO;g
  1154. s;{{DTR_DROPS_CARRIER}};$DTR_DROPS_CARRIER;g
  1155. s;{{HAVE_DUP2}};$have_dup2;g
  1156. s;{{HAVE_MEMSET}};$have_memset;g
  1157. s;{{HAVE_PID_T}};$have_pid_t;g
  1158. s;{{HAVE_STRCHR}};$have_strchr;g
  1159. s;{{HAVE_STRDUP}};$have_strdup;g
  1160. s;{{HAVE_STRRCHR}};$have_strrchr;g
  1161. s;{{HAVE_STRSTR}};$have_strstr;g
  1162. s;{{HAVE_ULONG}};$have_ulong;g
  1163. s;{{HAVE_UNCHAR}};$have_unchar;g
  1164. s;{{HAVE_USHORT}};$have_ushort;g
  1165. s;{{LIBDIR}};$LIBDIR;g
  1166. s;{{NOSHELL}};$NOSHELL;g
  1167. s;{{USER}};$USER;g
  1168. X" xc.h.in >xc.h
  1169. X
  1170. echo
  1171. echo "Creating Makefile.xc ..."
  1172. X
  1173. sed "
  1174. s;{{BINMODE}};$BINMODE;g
  1175. s;{{CATMAN}};$CATMAN;g
  1176. s;{{CC}};$CC;g
  1177. s;{{COPTS}};$COPTS;g
  1178. s;{{DATE}};$DATE;g
  1179. s;{{GROUP}};$GROUP;g
  1180. s;{{INSDIR}};$INSDIR;g
  1181. s;{{INSTALL}};$INSTALL;g
  1182. s;{{INSTPREF}};$INSTPREF;g
  1183. s;{{LDFLAGS}};$LDFLAGS;g
  1184. s;{{LIBDIR}};$LIBDIR;g
  1185. s;{{MANDIR}};$MANDIR;g
  1186. s;{{MANEXT}};$MANEXT;g
  1187. s;{{MDIR}};$MDIR;g
  1188. s;{{OWNER}};$OWNER;g
  1189. s;{{USER}};$USER;g
  1190. X" Makefile.in >Makefile.xc
  1191. X
  1192. echo
  1193. echo "XC Configuration is now complete..."
  1194. X
  1195. exit 0
  1196. END_OF_FILE
  1197. if test 8960 -ne `wc -c <'Configure'`; then
  1198.     echo shar: \"'Configure'\" unpacked with wrong size!
  1199. fi
  1200. chmod +x 'Configure'
  1201. # end of 'Configure'
  1202. fi
  1203. if test -f 'Copyright' -a "${1}" != "-c" ; then 
  1204.   echo shar: Will not clobber existing file \"'Copyright'\"
  1205. else
  1206. echo shar: Extracting \"'Copyright'\" \(496 characters\)
  1207. sed "s/^X//" >'Copyright' <<'END_OF_FILE'
  1208. XXC and its source files and sample scripts and manual page are Copyright
  1209. X1993 by Jean-Pierre Radley.
  1210. X
  1211. Permission is granted to the public to use this code in any manner, without
  1212. any warranty, implied or otherwise, of fitness for a particular purpose.
  1213. X
  1214. By virtue of a restriction previously placed upon all code derivative from
  1215. XXCOMM, the XC code and associated files may not be sold by anyone to anyone,
  1216. nor incorporated into any product that is not also free. It's OK to transfer
  1217. them for free.
  1218. END_OF_FILE
  1219. if test 496 -ne `wc -c <'Copyright'`; then
  1220.     echo shar: \"'Copyright'\" unpacked with wrong size!
  1221. fi
  1222. # end of 'Copyright'
  1223. fi
  1224. if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  1225.   echo shar: Will not clobber existing file \"'MANIFEST'\"
  1226. else
  1227. echo shar: Extracting \"'MANIFEST'\" \(1150 characters\)
  1228. sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
  1229. X   File Name        Archive #    Description
  1230. X-----------------------------------------------------------
  1231. X .aus                       1    
  1232. X .autocis                   1    
  1233. X .callhq                    1    
  1234. X .cisdial                   1    
  1235. X .exrc                      1    
  1236. X .pass                      1    
  1237. X .phonelist                 1    
  1238. X .rz                        1    
  1239. X .sz                        1    
  1240. X .temp_opt                  1    
  1241. X .uni                       1    
  1242. X .xc                        1    
  1243. X Configure                  1    
  1244. X Copyright                  1    
  1245. X MANIFEST                   1    
  1246. X Makefile                   1    
  1247. X Makefile.in                1    
  1248. X README                     1    
  1249. X bsdinst.sh                 1    
  1250. X call                       1    
  1251. X callback                   1    
  1252. X cisdownload                1    
  1253. X myman                      1    
  1254. X xc.h.in                    1    
  1255. X xc.nro                     3    
  1256. X xcb+.c                     2    
  1257. X xcdbglog.c                 1    
  1258. X xcdial.c                   1    
  1259. X xcmain.c                   2    
  1260. X xcport.c                   2    
  1261. X xcscrpt.c                  3    
  1262. X xcsubs.c                   1    
  1263. X xcterm.c                   1    
  1264. X xcxmdm.c                   2    
  1265. END_OF_FILE
  1266. if test 1150 -ne `wc -c <'MANIFEST'`; then
  1267.     echo shar: \"'MANIFEST'\" unpacked with wrong size!
  1268. fi
  1269. # end of 'MANIFEST'
  1270. fi
  1271. if test -f 'Makefile' -a "${1}" != "-c" ; then 
  1272.   echo shar: Will not clobber existing file \"'Makefile'\"
  1273. else
  1274. echo shar: Extracting \"'Makefile'\" \(283 characters\)
  1275. sed "s/^X//" >'Makefile' <<'END_OF_FILE'
  1276. X# Makefile for XC
  1277. SHELL=/bin/sh
  1278. X
  1279. all \
  1280. xc \
  1281. install \
  1282. install.suid \
  1283. xc.man \
  1284. install.man \
  1285. clean \
  1286. shar \
  1287. tah \
  1288. taz \
  1289. lha \
  1290. shark:            Makefile.xc xc.h
  1291. X                make $(MFLAGS) -f Makefile.xc $@
  1292. X
  1293. Makefile.xc:    Makefile.in Configure
  1294. X                ./Configure
  1295. X
  1296. xc.h:            xc.h.in Configure
  1297. X                ./Configure
  1298. END_OF_FILE
  1299. if test 283 -ne `wc -c <'Makefile'`; then
  1300.     echo shar: \"'Makefile'\" unpacked with wrong size!
  1301. fi
  1302. # end of 'Makefile'
  1303. fi
  1304. if test -f 'Makefile.in' -a "${1}" != "-c" ; then 
  1305.   echo shar: Will not clobber existing file \"'Makefile.in'\"
  1306. else
  1307. echo shar: Extracting \"'Makefile.in'\" \(2405 characters\)
  1308. sed "s/^X//" >'Makefile.in' <<'END_OF_FILE'
  1309. X# Makefile for XC
  1310. X# This file was generated by Configure on {{DATE}} by {{USER}}
  1311. X
  1312. BINMODE    = {{BINMODE}}
  1313. CATMAN    = {{CATMAN}}
  1314. CC        = {{CC}}
  1315. CFLAGS    = {{COPTS}}
  1316. GROUP    = {{GROUP}}
  1317. INSDIR    = {{INSDIR}}
  1318. LIBDIR    = {{LIBDIR}}
  1319. LDFLAGS    = {{LDFLAGS}}
  1320. MANDIR    = {{MANDIR}}/{{MDIR}}
  1321. MANEXT    = {{MANEXT}}
  1322. MANMODE    = 0444
  1323. OWNER    = {{OWNER}}
  1324. X
  1325. X# you should have all of these files:
  1326. X
  1327. MANIFEST    =\
  1328. X    .aus\
  1329. X    .autocis\
  1330. X    .callhq\
  1331. X    .cisdial\
  1332. X    .exrc\
  1333. X    .pass\
  1334. X    .phonelist\
  1335. X    .rz\
  1336. X    .sz\
  1337. X    .temp_opt\
  1338. X    .uni\
  1339. X    .xc\
  1340. X    Configure\
  1341. X    Copyright\
  1342. X    Makefile\
  1343. X    Makefile.in\
  1344. X    README\
  1345. X    bsdinst.sh\
  1346. X    call\
  1347. X    callback\
  1348. X    cisdownload\
  1349. X    myman\
  1350. X    xc.h.in\
  1351. X    xc.nro\
  1352. X    xcb+.c\
  1353. X    xcdbglog.c\
  1354. X    xcdial.c\
  1355. X    xcmain.c\
  1356. X    xcport.c\
  1357. X    xcscrpt.c\
  1358. X    xcsubs.c\
  1359. X    xcterm.c\
  1360. X    xcxmdm.c
  1361. X
  1362. OBJS =    xcb+.o\
  1363. X        xcdbglog.o\
  1364. X        xcdial.o\
  1365. X        xcmain.o\
  1366. X        xcport.o\
  1367. X        xcscrpt.o\
  1368. X        xcsubs.o\
  1369. X        xcterm.o\
  1370. X        xcxmdm.o
  1371. X
  1372. all:    xc
  1373. X    @echo "All targets are up to date"
  1374. X    @echo "Now you must {{INSTPREF}}execute 'make {{INSTALL}}'"
  1375. X
  1376. xc:        $(OBJS)
  1377. X    $(CC) $(CFLAGS) $(OBJS) -o xc $(LDFLAGS) 
  1378. X
  1379. X{{INSTALL}}:     xc
  1380. X    -mv $(INSDIR)/xc $(INSDIR)/xc-
  1381. X    ./bsdinst.sh -c -o $(OWNER) -g $(GROUP) -m $(BINMODE) -s xc $(INSDIR)/xc
  1382. X    -@ls -l ./xc $(INSDIR)/xc $(INSDIR)/xc-
  1383. X    @echo
  1384. X    @echo "The sample xc scripts (.aus .autocis .callhq .cisdial .exrc"
  1385. X    @echo ".pass .phonelist .rz .sz .temp_opt .uni .xc) should be manually"
  1386. X    @echo "moved to the $(LIBDIR) directory.  The shell scripts (call"
  1387. X    @echo "callback cisdownload) should be moved to the $(INSDIR) directory."
  1388. X    @echo
  1389. X    @echo "We do not do this automatically, as you may want to recompile xc"
  1390. X    @echo "with different options, yet not touch these scripts once you've"
  1391. X    @echo "personalized them with your own passwords and telephone numbers."
  1392. X
  1393. install.man:    xc.out
  1394. X    ./bsdinst.sh -c -m $(MANMODE) xc.out $(MANDIR)/xc.$(MANEXT)
  1395. X    touch install.man
  1396. X
  1397. xc.out:    xc.man
  1398. X    if $(CATMAN); then                \
  1399. X        nroff xc.man | col >xc.out;    \
  1400. X    else                            \
  1401. X            cat xc.man >xc.out;        \
  1402. X    fi
  1403. X
  1404. xc.man:    myman xc.nro
  1405. X    cat myman xc.nro | grep -v '^\.tm ' | tbl >xc.man
  1406. X
  1407. clean:;    rm -f $(OBJS) xc xc.man xc.out core man catman\
  1408. X        configure.out Makefile.xc xc.h *~ *\#
  1409. X
  1410. X$(OBJS):    xc.h
  1411. X
  1412. xc.h:    xc.h.in Configure
  1413. X    ./Configure
  1414. X
  1415. shar:
  1416. X    shar -awF -L51 -nXC -oXC -s jpr@jpr.com $(MANIFEST)
  1417. X    @ls -l XC.??
  1418. X
  1419. taz:
  1420. X    tar cf - $(MANIFEST) | compress > XC.TAR.Z
  1421. X    @ls -l *.Z
  1422. X
  1423. tah:
  1424. X    tar cf - $(MANIFEST) | compress -H > XC.TAR.Z
  1425. X    @ls -l *.Z
  1426. X
  1427. lha:
  1428. X    lha c XC $(MANIFEST)
  1429. X    @ls -L XC.A XC.lha
  1430. X
  1431. shark:
  1432. X    shark $(MANIFEST) > XC.SHK
  1433. X    @ls -l *SHK
  1434. END_OF_FILE
  1435. if test 2405 -ne `wc -c <'Makefile.in'`; then
  1436.     echo shar: \"'Makefile.in'\" unpacked with wrong size!
  1437. fi
  1438. # end of 'Makefile.in'
  1439. fi
  1440. if test -f 'README' -a "${1}" != "-c" ; then 
  1441.   echo shar: Will not clobber existing file \"'README'\"
  1442. else
  1443. echo shar: Extracting \"'README'\" \(14633 characters\)
  1444. sed "s/^X//" >'README' <<'END_OF_FILE'
  1445. X@(#) XC README, patchlevel 4.1 JPRadley 10 April 1993
  1446. This file (and almost every other one in the distribution) uses 4-character
  1447. tabstops.
  1448. The supplied .exrc file sets ts=4 and sw=4, for vi's purposes.
  1449. X
  1450. X
  1451. X    B A C K G R O U N D
  1452. X
  1453. Once upon a time (in 1985 or so), a fellow named Eric Coe wrote a Unix dialout
  1454. telecommunications program with xmodem called XCOMM. This program was
  1455. substantially upgraded and improved by another fellow named Larry Gensch, who
  1456. brought XCOMM up to Version 2.2. Version 2.2 included a simple script
  1457. language, 128-byte Xmodem and Compuserve Quick-B file-transfer protocols, and
  1458. some other stuff. Fred Buck then changed the program name to XCMALT, which it
  1459. maintained until June 1991, when Jean-Pierre Radley renamed it XC. 
  1460. X
  1461. XXC is a massive expansion and modification of XCOMM 2.2. Many bugs in
  1462. XXCOMM 2.2 have been fixed, and many advertised features that didn't work in
  1463. XXCOMM 2.2 do work in XC. Also, XC includes a fullscreen dialing directory; a
  1464. totally rewritten and much more powerful script language allowing, among other
  1465. things, remote execution of shell commands and unattended protocol-controlled
  1466. file transfer (provided that your system also has Chuck Forsberg's "rz/sz"
  1467. XXmodem/Ymodem/Zmodem program, available as shareware from many sources), a
  1468. flexible variable mechanism, including access to shell environment variables,
  1469. and more; BREAK-signal capability; the capability to upload a file in ASCII
  1470. from within a script; and miscellaneous cosmetic changes.
  1471. X
  1472. But while XC incorporates much of Larry Gensch's work, it's not supported by
  1473. Larry Gensch (although he contributed the key-binding features starting with
  1474. XXC3.2a). The changes from XCOMM 2.2 are the product of Steve Manes, who
  1475. installed uucp LCKfile support and special compile-time tuning for SCO Xenix,
  1476. and who wrote the fullscreen dialing directory; Fred Buck, who rewrote the
  1477. script language, performed various bugfixes and alterations, and installed
  1478. special compile-time tuning for the Tandy 6000; and Jean-Pierre Radley, who
  1479. installed the B+ Protocol, used more termcap features, and is now the
  1480. X"caretaker" of XC.
  1481. X
  1482. X
  1483. X    I N S T A L L A T I O N
  1484. X
  1485. Run Configure. There are various definitions that have to be set according
  1486. to your flavor of Unix, your preference for default directories, and other
  1487. user-definable items.
  1488. X
  1489. Typing just "make" will compile XC. On most systems, XC should be run "suid
  1490. uucp", and in order to do this, you should have chosen "uucp" as the user
  1491. to own the program, and 4755 as its permissions. If so, typing "make
  1492. install.suid" willl strip out its symbol table, place the program in INSDIR,
  1493. and change its modes and permissions accordingly. If you did not elect
  1494. this when running Configure, you can type "make install", but XC's permissions
  1495. will probably not allow it to properly cope with dial-in/dial-out ports.
  1496. X
  1497. The "xc.nro" file is 'nroff' source for a manual page which describes the
  1498. command-line options, the various commands once you're running XC, script
  1499. language, file transfers, and the price of milk in Soviet Georgia in 1986.
  1500. This file MUST pass through 'tbl' and 'col', e.g.,
  1501. X    "tbl xc.nro | nroff -man | col > /usr/man/cat.L/xc.L".
  1502. X
  1503. Some distribution files that you might adapt to your own purposes:
  1504. X
  1505. X    .exrc        sets tabstops and shiftwidth to 4, which is necessary
  1506. X                to properly view almost every file in the XC distribution.
  1507. X                It also contains, commented out, macros to help read
  1508. X                CompuServe message downloads, and to prepare replies.
  1509. X
  1510. X    .xc            sample startup script, demonstrates keyboard bindings
  1511. X
  1512. X    .phonelist    sample dialing directory data file
  1513. X
  1514. X    .callhq        sample script to call a Unix/Xenix system
  1515. X
  1516. X    .uni        sample script to call CompuServe and enter UnixForum
  1517. X
  1518. X    .aus        sample script to call CompuServe and enter, in turn,
  1519. X                SCOForum and UnixForum, uploading any prepared messages,
  1520. X                capturing all new messages into separate files, and
  1521. X                hanging up.
  1522. X
  1523. X    .autocis    sample script to call CompuServe, get any waiting
  1524. X                Mail into a capture file, then visit the PRACTICE
  1525. X                and the Unix Fora in turn, uploading any prepared
  1526. X                messages, capturing all new messages into separate
  1527. X                files, then hanging up.
  1528. X
  1529. X    .cisdial    meant to be called as a sub-script for dialing
  1530. X                CompuServe.
  1531. X
  1532. X    .temp_opt    meant to be called as a sub-script for temporary
  1533. X                setting of Options in a CompuServe Forum to make
  1534. X                efficient use of .autocis, .aus, or .uni.
  1535. X
  1536. X    .pass        a subscript containing passwords for various sites.
  1537. X                This should have very restrictive permissions.
  1538. X
  1539. X    .rz            sample script to receive files using the public
  1540. X                domain "rz/sz" package.
  1541. X
  1542. X    .sz            sample script to send files using the public domain
  1543. X                "rz/sz" package.
  1544. X
  1545. X    call        a Bourne shell script to use a spare modem to dial
  1546. X                voice calls for you.
  1547. X
  1548. X    callback    a Bourne shell script to call a site and have it
  1549. X                return the call and present a 'login:' prompt.
  1550. X
  1551. X    cisdownload a Bourne shell script to fetch a file from a Library
  1552. X                in a CompuServe Forum.
  1553. X
  1554. X
  1555. X    X C  R E V I S I O N  H I S T O R Y
  1556. X
  1557. Version 4.1 Gensch & Radley 4 Apr 93
  1558. X    Added Configure script
  1559. X    Took out T6000 conditional
  1560. X    Changed 7e|7o|8n to 7e2|7o2|8n1, with CSTOPB as needed
  1561. X
  1562. Version 3.4 Radley 13 Feb 1993
  1563. X    Took out bitmask and 7bit stuff, now have 7E, 7O, or 8N capability
  1564. X    Sleep(1) after PREFIX to allow modem to react (clue from Doug Scothorne)
  1565. X    Fixed newbmask signalling to prevent leak into B+ (clue from Jim Asman)
  1566. X    Deleted for-loops in s_dial and s_term (clue Brian Ferguson)
  1567. X    Tested for CO if no CN (clue Roy Johnson)
  1568. X
  1569. Version 4.0 Radley 11 Jun 1992
  1570. X    Used ANSI Prototype function declarations
  1571. X        (this road will not be travelled further...)
  1572. X
  1573. Version 3.3 Radley 25 May 1992
  1574. X    Provided call (clue from John Esak) and cisdownload shell scripts
  1575. X    Do not fork to terminal mode if stderr is not a tty
  1576. X    Added mini-menu
  1577. X    Merged Larry Gensch's 3.2a additions into xcscript.c
  1578. X    Used Larry Gensch's NIL-pointer macro throughout
  1579. X    Make a local copy of scriptname within S_Call()
  1580. X    Renamed isig() to mode()
  1581. X    Rearranged sections of the manual
  1582. X    Restored newbmask (clue from Doug Scothorne)
  1583. X    Set ptr = word early in k_waitfor (clue from Peter Smithem)
  1584. X    B+ Packet_Size requests 2k if bps > 2400 (CIS may eventually do this)
  1585. X    Use BS=c_cc[VERASE] == user's ERASE key (clue from Peter Gutmann)
  1586. X    Used oldmode before printing help or dialdir (clue from Bill Greene)
  1587. X    SYSVR4 mods for xcport.c (Larry Rosenman)
  1588. X
  1589. Version 3.2a Larry Gensch 22 Sep 1991
  1590. X    Made hard-coded terminal mode escape character a SETable value 
  1591. X    Added dynamic keyboard binding module
  1592. X    Added bind_function, bind_script, and bind_function to script language
  1593. X    Added fullword synonyms for command line keywords (eg, quit, term)
  1594. X    Incorporated show_bindings() into help display
  1595. X    Modified help display into more readable (to me, anyway) format
  1596. X    Added show_bindings() as a terminal mode function (esc - ?)
  1597. X    Fixed command line input routine
  1598. X
  1599. Version 3.2 Radley 24 Aug 1991
  1600. X    Set terminal's c_oflag to 0 (clue from Ronald Khoo)
  1601. X    Openfile fix (Peter Smithem)
  1602. X    Undefined toupper/tolower macros
  1603. X    Removed toggle() and introduced capt_on() and capt_off()
  1604. X    Changed diversion pacing back to using waitfor()
  1605. X    Changed send_slowly to send_string; left out inter-character delay
  1606. X    Removed newbmask
  1607. X    Purge() before doing a %take (clue from Bob Stockler)
  1608. X    Reinstalled xmodem crcheck as it was in 2.5 (clue from Volker Beyer)
  1609. X    Rearranged some modules to make gcc happier
  1610. X    Renamed intdel() to isig()
  1611. X    Unscrambled the SUCCESS/FAILURE nonsense in xcscrpt.c
  1612. X    Dropped trminp() in favor of fgetc()
  1613. X    Reworked signal handling
  1614. X
  1615. Version 3.1 Radley 14 Jul 1991
  1616. X    Purge() before starting B+ (Al Bolduc)
  1617. X    Eliminated purge as a set option.
  1618. X    Send \r, not \n, after the Byeptr (Al Bolduc)
  1619. X    When diverting from a script, pace by reading modem one line at a time
  1620. X    Combined capture/captflag, and cf/cfp
  1621. X
  1622. Version 3.0b Radley 08 Jul 1991
  1623. X    Eliminated mklow/mkhigh in favor of tolower/toupper
  1624. X    Shortened inter-line delay in script transmittal
  1625. X
  1626. Version 3.0a Radley 29 Jun 1991
  1627. X    Bugs re DIDO ports logic
  1628. X    Spelling errors in xc.nro
  1629. X    Added Buck-type CIS macros to .exrc
  1630. X
  1631. Version 3.0 Radley    06 Jun 1991
  1632. X    Program name XC replace XCMALT, by Jean-Pierre Radley
  1633. X
  1634. X    Ditched nap() in favor of times()
  1635. X    Cleaned up error handling in xcscrpt.c
  1636. X    Used NULLS and NULLF where appropriate
  1637. X    Used same crc table for xmodem and B+ (Mike Barton)
  1638. X    Increased size of f[] in xcdial.c (Tom Cattrall)
  1639. X    Introduced XC_PATH (Dan Everhart)
  1640. X    Won't mistake a directory for a script (clue from Bob Stockler)
  1641. X    Added "hangup" script keyword (Dan Everhart)
  1642. X    Forced 8N1 setting on opening port (clue from John James & Russ Ranshaw)
  1643. X    Cleaned up manual page
  1644. X    Included 38400 speed
  1645. X    Deleted ioctl(TCFLSH) from s_exit() (David Kindred)
  1646. X    Fixed spurious return to dialing directory after B_Transfer (David Kindred)
  1647. X    Fixed auto toggle after dialing without a script (clue from Roger Chaplin)
  1648. X    Use carat-char for a ctrl-char in waitfor as well as in transmit
  1649. X    Added MY_ESC-Q to quit XC from terminal mode (clue from Bill Hobson)
  1650. X
  1651. X
  1652. X    X C M A L T  R E V I S I O N  H I S T O R Y
  1653. X
  1654. X
  1655. Version 2.9 Radley 02 Sep 1990
  1656. X    Fixed error messages and file opening in xcb+.c when permission denied.
  1657. X
  1658. Version 2.8 Radley 01 Sep 1990
  1659. X    Fixed interrupt handling when dialing from phonelist (clue from Jim Asman)
  1660. X    Merged xcparse.c into xcscrpt.c
  1661. X    Fixed backspace handling in getline()
  1662. X    Used getline() inside man_dial()
  1663. X    Did away with using /dev/tty
  1664. X    For cron: do not bother with TERM if !isatty()
  1665. X    Fixed page counting in dial directory routines (clue from Mike Squires)
  1666. X    Changed Msg[80] to Msg[SM_BUFF] (clue from Dave Cardinal )
  1667. X    Fixed a bad tgetstr() call (clue from Per Bilse)
  1668. X
  1669. Version 2.7 Radley 12 June 1990
  1670. X    Merge install.doc into xcmalt.h and README
  1671. X    Change xcmalt.doc to nroff source
  1672. X    Add cr_add flag to insert [or not] CRs after NLs in B+ uploads
  1673. X
  1674. Version 2.6.1 Betz, Cattrall, Roberts, Scothorne, Radley 13 May 90
  1675. X    Use separate rxbuf and kbbuf for port/keyboard input (Tom Cattrall)
  1676. X    Stretched some sleep and nap delays (Doug Scothorne)
  1677. X    Removed '/' from INSDIR definition in Makefile (Tom Betz)
  1678. X    Fixed bug in while/do/call script/done logic (clue from Tom Roberts)
  1679. X    Removed dd_done variable
  1680. X    Fixed terminal(todir) logic
  1681. X
  1682. Version 2.6 Radley 29 April 1990
  1683. X    Reinstated SCO 2.2 ungetty calls
  1684. X    Deleted crc setting, xmodem now always done with CRC
  1685. X    Added auto flag, automatically start capture on entering terminal mode
  1686. X    Used tputs() for screen control strings.
  1687. X
  1688. Version 2.5 George Pontis & Jean-Pierre Radley 19 April 1990
  1689. X    Use ioctl.h only for the T6000
  1690. X    Fixed calls to nap() for BSD
  1691. X    Fixed statbuf() declaration bug in xcport.c
  1692. X    Included mklow()/mkhigh() as frontends to tolower()/toupper()
  1693. X    Included NOSHELL option
  1694. X    Exits mopen() if no port specified
  1695. X
  1696. Version 2.4 Radley    31 Mar 1990
  1697. X    Made all identifiers unique in first seven characters.
  1698. X    Replaced incorrect references to "baud" and "baud-rate" by
  1699. X     "bps" and "bits/second"
  1700. X
  1701. Version 2.3 Radley 19 Feb 1990
  1702. X    B-Plus replaces Quick-B
  1703. X    Reinstated xclog code
  1704. X    No mungmode variable; overwriting of a file interactively confirmed.
  1705. X    No term variable; all transfers return to Terminal mode.
  1706. X    Added timer.c, to calibrate the built-in nap() code.
  1707. X
  1708. Version 2.2    Radley    05 Jan 1990
  1709. X    Removed XCLUDE termio setting, which locked port on first fopen()
  1710. X    Change setuid to be uid of 'uucp'
  1711. X    Fixed set/get/uid routines
  1712. X    Revised menu display
  1713. X    Removed xclog code from xccisb.c
  1714. X    Changed many TCSETAW ioctl calls to TCSETA
  1715. X
  1716. Version 2.1    Radley    12 Dec 1989
  1717. X    Revised all inverse video displays
  1718. X    Took out more unnecessary routines
  1719. X    Permitted operation from 'cron' or 'at'
  1720. X    Fixed some of the interrupt routines
  1721. X    Removed PUT_TAKE manifest, code for put/take now always included
  1722. X    Fixed some of the mopen() routines.
  1723. X    Did away with DRIBBLE, use nap() instead
  1724. X
  1725. Version 2.0    Radley    9 Aug 1989
  1726. X    Added openfile routine (credit to George Pontis)
  1727. X    Added LIBDIR (credit to George Pontis)
  1728. X    Used setbuf on local tty (credit to George Pontis)
  1729. X    Eliminated fflush() calls
  1730. X    Fixed put and take code
  1731. X    Deleted SCO 2.2 ungetty stuff
  1732. X
  1733. Version 1.0 ...all in or about, oh, say, 1988.
  1734. X    CD-independent modem opening added by Fred Buck/J-P Radley
  1735. X    Broken shell-escape mechanism fixed by Fred Buck
  1736. X    Tandy 6000 LCKfile support added by Fred Buck
  1737. X    Flexible LCKfile support added by Steve Manes
  1738. X    Same, for SCO 2.2, added by J-P Radley
  1739. X    Fullscreen dialing directory added by Steve Manes
  1740. X    Fullscreen dialing directory tuned by Fred Buck/J-P Radley
  1741. X    Shell-escape ignore-SIGINT bug fixed by Fred Buck
  1742. X    Command-mode ignore-xon/xoff bug fixed by Fred Buck
  1743. X    Script parsing greatly extended by Fred Buck
  1744. X    "BYE" sequence to modem on exit added by Fred Buck
  1745. X
  1746. X    Program named XCMALT instead of XCOMM, by Fred Buck
  1747. X
  1748. X
  1749. X    X C O M M  R E V I S I O N  H I S T O R Y
  1750. X
  1751. X
  1752. Version 2.2    larry gensch    14 Dec 87    Major code restructure
  1753. X    Reduced program and command options
  1754. X    Added SET command for setting various parameters
  1755. X    Added HANGUP command for disconnecting modem
  1756. X    Modified xccisb.c code to support CIS "Quick B" Protocol
  1757. X    Added xcscrpt.c code for processing script files
  1758. X    Added SCRIPT= parameter to phonebook processing (auto-logon scripts)
  1759. X    Added CIS parameter for CIS <ENQ> auto transfers
  1760. X    Added NL parameter for newline translation
  1761. X    Added HANGUP command from terminal mode
  1762. X    Added SCRIPT command from terminal mode
  1763. X
  1764. Version 2.1b    larry gensch    11 Nov 87    Bug Fix release
  1765. X    (no bugs in the code, just some portability fixes)
  1766. X    Changed "sigset" in xccisb to "signal"
  1767. X    Removed #include <setjmp.h> from xcxmdm
  1768. X
  1769. Version 2.1a    larry gensch    28 Oct 87    General Update
  1770. X    Added CIS "B" Protocol (c, ct commands)
  1771. X    Added BAUD= & BITS= parameters to phonelist file.
  1772. X    Switched some command letters
  1773. X    Revised command line parsing to use getopt()
  1774. X
  1775. Version 2.0    larry gensch    19 Oct 87    Revisions for System V.3
  1776. X    Changed <sgtty> references to <termio> (modified ioctl(2) calls)
  1777. X    Changed terminal mode function keys to <ESC> sequences; added
  1778. X        getconchr()
  1779. X
  1780. Version 1.1    Eric E Coe    21 Jul 85
  1781. X    Autodial for Hayes-compatible modem.
  1782. X    General rearranging of the code
  1783. X
  1784. Version 1.0    Eric E Coe    12 Apr 85
  1785. X    Program created
  1786. X
  1787. X
  1788. X===================================
  1789. X
  1790. X
  1791. Note: in the original XCOMM file "install.doc", Larry Gensch gave his
  1792. various mail addresses for users to reach him about bug reports, upgrade
  1793. requests, and the like. But Larry doesn't support (or in fact have anything
  1794. to do with) XC/XCMALT, except as a contributor, and the fact that
  1795. XXCMALT is based on XCOMM 2.2, so there's no point in including this
  1796. information here. 
  1797. XFred Buck, who made the major changes from XCOMM to XCMALT, passed away in
  1798. early 1989.
  1799. Jean-Pierre Radley has since been shepherding the program as it evolved from
  1800. XXCMALT to XC.
  1801. X
  1802. Gripes, bugs, and comments accepted by:
  1803. X    Jean-Pierre Radley
  1804. X      jpr@jpr.com
  1805. X      72160.1341@compuserve.com
  1806. END_OF_FILE
  1807. if test 14633 -ne `wc -c <'README'`; then
  1808.     echo shar: \"'README'\" unpacked with wrong size!
  1809. fi
  1810. # end of 'README'
  1811. fi
  1812. if test -f 'bsdinst.sh' -a "${1}" != "-c" ; then 
  1813.   echo shar: Will not clobber existing file \"'bsdinst.sh'\"
  1814. else
  1815. echo shar: Extracting \"'bsdinst.sh'\" \(1648 characters\)
  1816. sed "s/^X//" >'bsdinst.sh' <<'END_OF_FILE'
  1817. X#! /bin/sh
  1818. X#
  1819. X# This accepts bsd-style install arguments and executes them
  1820. X#
  1821. X
  1822. die()
  1823. X{
  1824. X    echo "$*" 1>&2
  1825. X    exit 1
  1826. X}
  1827. X
  1828. dest=""
  1829. src=""
  1830. strip="false"
  1831. owner=""
  1832. group=""
  1833. mode="755"
  1834. X
  1835. while [ -n "$1" ]
  1836. do
  1837. X    case $1 in 
  1838. X    -c)    ;;
  1839. X
  1840. X    -m)    mode="$2"
  1841. X        shift
  1842. X        ;;
  1843. X
  1844. X    -o) owner="$2"
  1845. X        shift
  1846. X        ;;
  1847. X
  1848. X    -g) group="$2"
  1849. X        shift
  1850. X        ;;
  1851. X
  1852. X    -s) strip="true"
  1853. X        ;;
  1854. X
  1855. X    -*)    die "Illegal option"
  1856. X        ;;
  1857. X
  1858. X    *)    if [ -z "$2" ]
  1859. X        then
  1860. X            dest="$1"
  1861. X            break
  1862. X        fi
  1863. X
  1864. X        src="$src $1"
  1865. X
  1866. X        if [ ! -f "$1" -o ! -r "$1" ]
  1867. X        then
  1868. X            die "$1: file does not exist or is not readable"
  1869. X        fi
  1870. X    ;;
  1871. X    esac
  1872. X
  1873. X    shift
  1874. done
  1875. X
  1876. X[ -n "$dest" ] || die "No destination specified"
  1877. X
  1878. X[ -n "$src" ] || die "No file specified"
  1879. X
  1880. if [ ! -d "$dest" ]
  1881. then
  1882. X    count=0
  1883. X    for i in $src
  1884. X    do
  1885. X        count=`expr $count + 1`
  1886. X    done
  1887. X
  1888. X    if [ "$count" -eq 1 ]
  1889. X    then
  1890. X        parent=`dirname $dest`
  1891. X        if [ -d "$parent" ]
  1892. X        then
  1893. X            newname=`basename $dest`
  1894. X            dest=$parent
  1895. X        fi
  1896. X    fi
  1897. X
  1898. X    [ -n "$newname" ] || die "$dest: No such directory"
  1899. fi
  1900. X
  1901. X# Here's where the real work happens.  Note that on some systems, chown
  1902. X# clears SUID and SGID bits for non-superusers.  Thus, the chmod has to
  1903. X# follow chown.  However, under System V, you can not chmod SUID or SGID
  1904. X# permissions unless you are the owner or superuser.
  1905. X# If you are in doubt, "su" first!
  1906. X
  1907. for i in $src
  1908. do
  1909. X    set -e
  1910. X
  1911. X    ofile=$dest/${newname:-$i}
  1912. X
  1913. X    rm -f $ofile
  1914. X
  1915. X    cp $i $ofile
  1916. X
  1917. X    if $strip
  1918. X    then
  1919. X        strip $ofile
  1920. X        if i386
  1921. X        then
  1922. X            mcs -d $ofile
  1923. X        fi
  1924. X    fi
  1925. X
  1926. X    if [ -n "$group" ]
  1927. X    then
  1928. X        chgrp $group $ofile
  1929. X    fi
  1930. X
  1931. X    if [ -n "$owner" ]
  1932. X    then
  1933. X        chown $owner $ofile
  1934. X    fi
  1935. X
  1936. X    chmod $mode $ofile
  1937. X
  1938. X    set +e
  1939. done
  1940. X
  1941. exit 0
  1942. END_OF_FILE
  1943. if test 1648 -ne `wc -c <'bsdinst.sh'`; then
  1944.     echo shar: \"'bsdinst.sh'\" unpacked with wrong size!
  1945. fi
  1946. chmod +x 'bsdinst.sh'
  1947. # end of 'bsdinst.sh'
  1948. fi
  1949. if test -f 'call' -a "${1}" != "-c" ; then 
  1950.   echo shar: Will not clobber existing file \"'call'\"
  1951. else
  1952. echo shar: Extracting \"'call'\" \(1989 characters\)
  1953. sed "s/^X//" >'call' <<'END_OF_FILE'
  1954. X: <<AH_SO
  1955. X    "call": @(#) JPRadley Mon Jun 01 20:49:48 EDT 1992 v. 0.3
  1956. X    This file uses 8-character tabstops.
  1957. X  An ecological recycling program for obsolete modems.
  1958. X  Uses 'xc' to dial on port M, giving a key ($1) to look up in file P, whose
  1959. lines have the format "one or more keys<TAB>number"
  1960. X  Thus, if P has "mom dad hometown<TAB>1-234-567-8900", this will dial that
  1961. number by typing "call mom", "call dad", "call home", "call town"; pick up
  1962. the handset within 10 seconds, talk to the folks.
  1963. X  If $1 isn't a valid key in P, then dial $1 itself, so that "call 12024561000"
  1964. will dial the White House in DC.
  1965. X  "call grklfitch" does no harm: the modem won't react to ATDTgrklfitch.
  1966. X  Unless you have version 3.3 or higher of 'xc', do NOT hit the BREAK key while
  1967. this script is running; you may be left with scads of orphaned 'xc' processes.
  1968. AH_SO
  1969. X
  1970. X[ $# -lt 1 ] && exit    # one argument, key or number, needed
  1971. M=ttyA07                # voice line with a modem on it
  1972. P=/pub/jpr/lib/numbers  # data file
  1973. X                        # next line: <TAB> between '*' and '/'
  1974. N=`sed -n "/$1/{s/.*$1.*    //p
  1975. q
  1976. X}" $P`
  1977. N=${N:-$1}              # if $1 wasn't a key, use $1 itself
  1978. S=/usr/tmp/call_$$      # temporary script for xc to use
  1979. X
  1980. trap "rm $S" 0          # clean up
  1981. X
  1982. cat >$S <<JPR
  1983. set bps 300             # override whatever the .xc startup file sets
  1984. set cfile "/dev/tty"    # set up a hack for screen display, since later we
  1985. capture "on"            #  redirect the usual xc output to the bit bucket
  1986. file echo "dialing $N"  # spring the hack
  1987. dial "W$N"              # precede by a 'w' to wait for dial tone
  1988. pause 10                # give a human a chance to pick up the handset
  1989. X#hangup                 # dropping DTR may not work on old modems
  1990. transmit "ath^m"        #   so use this instead
  1991. pause 1                 # it's an old modem, give it a chance to react
  1992. quit                    # xc quits and the modem is off the voice line
  1993. JPR
  1994. X
  1995. xc -l$M -s$S 2>/dev/null     # shut off normal xc screen output
  1996. END_OF_FILE
  1997. if test 1989 -ne `wc -c <'call'`; then
  1998.     echo shar: \"'call'\" unpacked with wrong size!
  1999. fi
  2000. chmod +x 'call'
  2001. # end of 'call'
  2002. fi
  2003. if test -f 'callback' -a "${1}" != "-c" ; then 
  2004.   echo shar: Will not clobber existing file \"'callback'\"
  2005. else
  2006. echo shar: Extracting \"'callback'\" \(3377 characters\)
  2007. sed "s/^X//" >'callback' <<'END_OF_FILE'
  2008. X#!/bin/sh
  2009. X# @(#) callback - JPRadley v1.0 920921 - makes and uses an 'xc' script to
  2010. X# @(#)   call a remote site, have it ring us back with a login prompt.
  2011. X
  2012. echo -n "Remote system name? "
  2013. read SYSTEM                     # where are we calling?
  2014. echo -n "Their modem number? "
  2015. read NUMBER                     # what's the telephone number?
  2016. echo -n "Login name on $SYSTEM? "
  2017. read LOGIN                      # how shall we log in?
  2018. echo -n "Password for $LOGIN? "
  2019. stty -echo                      # but of course!
  2020. read PASSWD
  2021. stty echo
  2022. echo -n "\nBaud remote should use? "
  2023. read RSPEED                     # computer-modem speed on the remote
  2024. echo
  2025. X
  2026. What_To_Do=/usr/tmp/$SYSTEM.$$  # script for 'xc' to use
  2027. OURPORT=ttyA02                  # we'll dial out on this port and the remote
  2028. OURNBR=7874639                  #  calls this number to ring this port
  2029. CAPTURE=/pub/jpr/logs/$SYSTEM   # our log file for the session
  2030. X
  2031. trap "rm $What_To_Do" 0         # clean up when we leave
  2032. X
  2033. cat >$What_To_Do <<TeMpLaTe
  2034. debug "off"
  2035. tty "off"
  2036. set cfile $CAPTURE                
  2037. set auto "off"                  # no capturing -- yet
  2038. set cis "off"                   # don't react to a spurious ^E
  2039. X
  2040. transmit "ats0=0e1q0v1^M"       # modem should not be mute
  2041. waitfor "ok"
  2042. X
  2043. dial "$NUMBER"
  2044. echo "        Dialing $NUMBER to get on to $SYSTEM"
  2045. while ! waitfor "connect" 70
  2046. do
  2047. X        echo "        No connection; redialing"
  2048. X        redial                        
  2049. done
  2050. X
  2051. transmit "^M"                   # can't hurt
  2052. X
  2053. assign PATIENCE eq 3            # loop counter
  2054. while ! waitfor "ogin:" 6       # waiting 6 secs for the prompt
  2055. do
  2056. X        if PATIENCE eq 0
  2057. X        then    echo "Can't get a login prompt"
  2058. X                beep; quit
  2059. X        fi
  2060. X        xmitbrk
  2061. X        decr PATIENCE
  2062. done
  2063. X
  2064. pause 2
  2065. X
  2066. transmit "$LOGIN^M"
  2067. echo "        We're logging in now"
  2068. X
  2069. if ! waitfor "word:"
  2070. then
  2071. X        echo "Login failed, sorry!" ; beep; quit
  2072. else
  2073. X        transmit "$PASSWD^M^M"  # the second CR is to cope with a possible
  2074. endif                           #  tset command, and accept its default
  2075. X
  2076. transmit "/1/2/3^M"             # an absolute pathname that shouldn't exist
  2077. if waitfor "not found"
  2078. then
  2079. X        echo "        OK, we're on $SYSTEM; now we'll set up a callback"
  2080. else
  2081. X        echo "Login failed, sorry!" ; beep; quit
  2082. fi
  2083. X
  2084. transmit "echo 'yes|ct -w3 -s$RSPEED $OURNBR 2>/dev/null' | at now next min^M"
  2085. waitfor "job"                   # the 'at' command reports a job number
  2086. transmit "exit^M"               # get off the remote system
  2087. X
  2088. pause 2                         # disconnect might reset modem, so again:
  2089. transmit "ats0=1e1q0v1^M"       #  not mute, and auto-answer
  2090. waitfor "ok"
  2091. X
  2092. echo "        It might be a couple of minutes until $SYSTEM rings us"
  2093. if ! waitfor "connect" 190
  2094. then
  2095. X        echo "        It ain't gonna happen; sorry!"
  2096. X        beep; quit
  2097. endif
  2098. X
  2099. transmit "^M"
  2100. assign PATIENCE eq 3
  2101. while ! waitfor "ogin:" 6
  2102. do
  2103. X        if PATIENCE eq 0; then beep; quit; fi
  2104. X        xmitbrk; decr PATIENCE
  2105. done
  2106. pause 1; transmit "$LOGIN^M"
  2107. if ! waitfor "word:"; then beep; quit
  2108. else transmit "$PASSWD^M^M"
  2109. fi
  2110. X
  2111. set auto "on"                   # capturing starts when we hit terminal mode
  2112. X
  2113. transmit "/1/2/3; echo Thanks, \`uname\`, for providing this connection!^M"
  2114. waitfor "not found"
  2115. beep
  2116. TeMpLaTe
  2117. X
  2118. xc -s$What_To_Do -l$OURPORT
  2119. X
  2120. X# th-th-aaa-t's all, folks, just drop those nickels & dimes in the slot...
  2121. X
  2122. X# eof(callback)
  2123. END_OF_FILE
  2124. if test 3377 -ne `wc -c <'callback'`; then
  2125.     echo shar: \"'callback'\" unpacked with wrong size!
  2126. fi
  2127. chmod +x 'callback'
  2128. # end of 'callback'
  2129. fi
  2130. if test -f 'cisdownload' -a "${1}" != "-c" ; then 
  2131.   echo shar: Will not clobber existing file \"'cisdownload'\"
  2132. else
  2133. echo shar: Extracting \"'cisdownload'\" \(1688 characters\)
  2134. sed "s/^X//" >'cisdownload' <<'END_OF_FILE'
  2135. X: << README
  2136. This file uses 8-character tabstops.
  2137. cisdownload @(#)Download CIS LIB file with XC   JPRadley 20 May 92 vers 0.1
  2138. Assumes System-wide preference for B+ set in GO PROFILE.
  2139. Assumes Prompt character in all Fora is ^H.
  2140. X
  2141. Could use more checks. Providing a non-existent Forum, or one which one
  2142. has not joined; providing an incorrect or inaccessible LIB number;
  2143. providing a non-existent filename: all of these will cause failure
  2144. while the meter's ticking.
  2145. But if "all systems are go", then this should save a few pennies.
  2146. README
  2147. X
  2148. echo "\n\tDownload a file from CompuServe using XC"
  2149. echo "\n\tDefault answers are in brackets"
  2150. X
  2151. echo "\nWhat Forum [unixforum] ? \c"
  2152. read GO
  2153. XFORUM=`echo ${GO:=UnixForum} | tr '[A-Z]' '[a-z]'`
  2154. X
  2155. echo -n "\nWhat Library [1] ? \c"
  2156. read RARY
  2157. LIB="LIB "${RARY:=1}
  2158. X
  2159. until test "$THERE"
  2160. do
  2161. X    echo "\nName (case-insensitive) of the file on CIS? \c"
  2162. X    read THERE
  2163. done
  2164. X
  2165. WHERE="[$THERE] "
  2166. while :
  2167. do
  2168. echo -n "\nPathname (case-sensitive) to use here $WHERE? "
  2169. X    read AND
  2170. X    HERE=${AND:-$THERE}
  2171. X    if test -f "$HERE" || test -d "$HERE"
  2172. X    then
  2173. X        echo "\n'$HERE' already exists. You may BREAK from this"
  2174. X        echo "script and either remove or rename '$HERE',"
  2175. X        echo "or choose another name instead.\n"
  2176. X        WHERE=''
  2177. X    else
  2178. X        break
  2179. X    fi
  2180. done
  2181. X
  2182. S=/usr/tmp/Download$$    # not publicly readable, to protect CIS password
  2183. trap 'rm $S' 0 2 3
  2184. X
  2185. cat >$S <<sCrIpT
  2186. set cis "on"
  2187. X
  2188. call ".cisdial"
  2189. X
  2190. pause 3; transmit "^C"
  2191. assign SERVICE eq "$FORUM"
  2192. call ".pass"
  2193. tty "on"
  2194. X
  2195. waitfor "moment please..."
  2196. if ! waitfor "forum !^H" 60; then transmit "bye^M"; quit; endif
  2197. X
  2198. transmit "$LIB^M"
  2199. waitfor "$LIB !^H"
  2200. transmit "DOW $THERE^M"
  2201. transmit "$HERE^M"
  2202. X
  2203. waitfor "$LIB !^H"
  2204. transmit "off^M"
  2205. X
  2206. quit
  2207. sCrIpT
  2208. X
  2209. xc -s$S
  2210. END_OF_FILE
  2211. if test 1688 -ne `wc -c <'cisdownload'`; then
  2212.     echo shar: \"'cisdownload'\" unpacked with wrong size!
  2213. fi
  2214. chmod +x 'cisdownload'
  2215. # end of 'cisdownload'
  2216. fi
  2217. if test -f 'myman' -a "${1}" != "-c" ; then 
  2218.   echo shar: Will not clobber existing file \"'myman'\"
  2219. else
  2220. echo shar: Extracting \"'myman'\" \(2569 characters\)
  2221. sed "s/^X//" >'myman' <<'END_OF_FILE'
  2222. X'''\"    JPRadley 'myman' macros June 1989
  2223. X.dsx1 XENIX/UNIX
  2224. X..
  2225. X.de}E
  2226. X.ft1
  2227. X.in\\n()Ru+\\n(INu
  2228. X.ll\\n(LLu
  2229. X.lt\\n(LLu
  2230. X.pl\\n()Lu
  2231. X..
  2232. X.deDT
  2233. X..
  2234. X.de}H
  2235. X.ev1
  2236. X'  .lt7.5i
  2237. X.}E
  2238. X.ie@@\\*(]L@ .tl @\\*(]H@\\*(]D@\\*(]W@
  2239. X.el.tl @\\*(]H@\\*(]D \|\\*(]L@\\*(]W@
  2240. X.sp
  2241. X.ev
  2242. X.ns
  2243. X..
  2244. X.deTH
  2245. X.nrIN \\n()Mu
  2246. X.ds]H \\$1(\\$2)
  2247. X.ds]D \*(x1
  2248. X.ds]L
  2249. X.if!@\\$3@@ .ds ]L (\^\\$3\^)
  2250. X.if!@\\$4@@ .ds ]D \\$4
  2251. X.}H
  2252. X.nr)I \\n()Mu
  2253. X.nr)R 0
  2254. X.}E
  2255. X.na
  2256. X.hy14
  2257. X..
  2258. X.deSH
  2259. X.}X 0 "\\$1" smaller
  2260. X.nr)E 2
  2261. X\&\\$1 \|\\$2 \|\\$3 \|\\$4 \|\\$5 \|\\$6
  2262. X..
  2263. X.deSS
  2264. X.}X3n "" ""
  2265. X.nr)E 2
  2266. X\&\\$1 \|\\$2 \|\\$3 \|\\$4 \|\\$5 \|\\$6
  2267. X..
  2268. X.de}X
  2269. X.}E
  2270. X.ti\\$1
  2271. X.sp
  2272. X.nr)R 0
  2273. X.fi
  2274. X.it1 }N
  2275. X.if!@\\$3@@ .SM
  2276. X..
  2277. X.de}2
  2278. X.nr)E 0
  2279. X.}E
  2280. X.nr)I \\n()Mu
  2281. X.ns
  2282. X..
  2283. X.deSM
  2284. X.if!@\\$1@@ \&\\$1
  2285. X.if!@\\$2@@ \&\\$2
  2286. X.if!@\\$3@@ \&\\$3
  2287. X.if!@\\$4@@ \&\\$4
  2288. X.if!@\\$5@@ \&\\$5
  2289. X.if!@\\$6@@ \&\\$6
  2290. X.if@\\$1@@ .it 1 }N
  2291. X..
  2292. X.deI
  2293. X.ft2
  2294. X.it1 }N
  2295. X.if!@\\$1@@ \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
  2296. X..
  2297. X.deB
  2298. X.ft3
  2299. X.it1 }N
  2300. X.if!@\\$1@@ \&\\$1 \\$2 \\$3 \\$4 \\$5 \\$6 \\$7 \\$8 \\$9
  2301. X..
  2302. X.deRI
  2303. X.}S1 2 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
  2304. X..
  2305. X.deIR
  2306. X.}S2 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
  2307. X..
  2308. X.deIB
  2309. X.}S2 3 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
  2310. X..
  2311. X.deRB
  2312. X.}S1 3 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
  2313. X..
  2314. X.deBR
  2315. X.}S3 1 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
  2316. X..
  2317. X.deBI
  2318. X.}S3 2 \& "\\$1" "\\$2" "\\$3" "\\$4" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
  2319. X..
  2320. X.de}S
  2321. X.ds]F
  2322. X.if@\\$1@2@ .if !@\\$5@@ .ds ]F\^
  2323. X.ie!@\\$4@@ .}S \\$2 \\$1 "\\$3\f\\$1\\$4\\*(]F" "\\$5" "\\$6" "\\$7" "\\$8" "\\$9"
  2324. X.el\\$3
  2325. X.ft1
  2326. X..
  2327. X.dePP
  2328. X.sp
  2329. X.}E
  2330. X.nr)I \\n()Mu
  2331. X.ns
  2332. X..
  2333. X.deP
  2334. X.PP
  2335. X..
  2336. X.deLP
  2337. X.PP
  2338. X..
  2339. X.deHP
  2340. X.sp
  2341. X.if!@\\$1@@ .nr )I \\$1n
  2342. X.ll\\n(LLu
  2343. X.in\\n()Ru+\\n(INu+\\n()Iu
  2344. X.ti\\n()Ru+\\n(INu
  2345. X.ft1
  2346. X..
  2347. X.deIP
  2348. X.TP \\$2
  2349. X\&\\$1
  2350. X..
  2351. X.deTP
  2352. X.if!@\\$1@@ .nr )I \\$1n
  2353. X.sp
  2354. X.in\\n()Ru
  2355. X.ns
  2356. X.it1 }N
  2357. X.nr)E 1
  2358. X.di]B
  2359. X..
  2360. X.de}1
  2361. X.ds]X \&\\*(]B\\
  2362. X.rm]B
  2363. X.nr)E 0
  2364. X.if!@\\$1@@ .nr )I \\$1n
  2365. X.ft1
  2366. X.ll\\n(LLu
  2367. X.in\\n()Ru+\\n(INu+\\n()Iu
  2368. X.ti\\n(INu
  2369. X.ie!\\n()Iu+\\n()Ru-\w@\\*(]X@u-3p \{\\*(]X
  2370. X.br\}
  2371. X.el\\*(]X\h@|\\n()Iu+\\n()Ru@\c
  2372. X.ft1
  2373. X..
  2374. X.de}N
  2375. X.if\\n()E .br
  2376. X.di
  2377. X.if@\\n()E@0@ .ft1
  2378. X.if@\\n()E@1@ .}1
  2379. X.if@\\n()E@2@ .}2
  2380. X..
  2381. X.deRS
  2382. X.nr]\\n+()p \\n()I
  2383. X.nr)\\n()p \\n()R
  2384. X.ie!@\\$1@@ .nr )R +\\$1n
  2385. X.el.nr )R +\\n()I
  2386. X.nr)I \\n()Mu
  2387. X.}E
  2388. X..
  2389. X.deRE
  2390. X.if!@\\$1@@ \{.ie @\\$1@0@ .nr )p 1 1
  2391. X.el.nr )p \\$1 1 \}
  2392. X.ds]i \\*(]I\\n()p
  2393. X.ds]r \\*(]R\\n()p
  2394. X.nr)I \\*(]i
  2395. X.nr)R \\*(]r
  2396. X.if\\n()p .nr )p -1
  2397. X.}E
  2398. X..
  2399. X.dePM
  2400. X..
  2401. X.nr )L 0
  2402. X.nrLL 7.9i
  2403. X.dsR (Reg.)
  2404. X.nr)p 0 1
  2405. X.ds]I \\\\n(]
  2406. X.ds]R \\\\n()
  2407. X.ds ]W (printed \n(mo/\n(dy/\n(yr)
  2408. X.pl\n()Lu
  2409. X.ll\n(LLu
  2410. X.lt\n(LLu
  2411. X.ft1
  2412. X.nr )M 8n
  2413. END_OF_FILE
  2414. if test 2569 -ne `wc -c <'myman'`; then
  2415.     echo shar: \"'myman'\" unpacked with wrong size!
  2416. fi
  2417. # end of 'myman'
  2418. fi
  2419. if test -f 'xc.h.in' -a "${1}" != "-c" ; then 
  2420.   echo shar: Will not clobber existing file \"'xc.h.in'\"
  2421. else
  2422. echo shar: Extracting \"'xc.h.in'\" \(7656 characters\)
  2423. sed "s/^X//" >'xc.h.in' <<'END_OF_FILE'
  2424. X/*    xc.h -- header  file for XC
  2425. X    This file was generated by configure on {{DATE}} by {{USER}}
  2426. X    This file uses 4-character tabstops
  2427. X*/
  2428. X
  2429. X/* Local preferences and modems */
  2430. X
  2431. X/*    CAPTFILE
  2432. X    This is the default name given to the capture buffer in terminal mode (and
  2433. X    during script processing). You can always reset this while running the
  2434. X    program.
  2435. X*/
  2436. X#define    CAPTFILE "capture.log"    /* Default capture file */
  2437. X
  2438. X/*    LIBDIR
  2439. X    This is the default name given to a directory where PHFILE, STARTUP, and
  2440. X    any XC scripts might be found. XC will search for such files
  2441. X        1st) in a path in a colon-separated list of directories in
  2442. X             XC_PATH, if such an environment variable exists,
  2443. X        2nd) in the current directory,
  2444. X        3rd) in your HOME directory, if HOME is an environment variable,
  2445. X        4th) in LIBDIR.
  2446. X*/
  2447. X#define LIBDIR "{{LIBDIR}}"
  2448. X
  2449. X/*    PHFILE
  2450. X    This is the default name given to the dialing directory.
  2451. X*/
  2452. X#define PHFILE ".phonelist"        /* Default phonelist file */
  2453. X
  2454. X/*    STARTUP
  2455. X    This is the default name of the startup script for XC. If this file is
  2456. X    found it will be executed immediately on XC startup.
  2457. X*/
  2458. X#define STARTUP ".xc"            /* XC Startup Script */
  2459. X
  2460. X/*    DIALSTR
  2461. X    A format string to send a telephone number to the modem with the
  2462. X    appropriate dialing command.
  2463. X*/
  2464. X#define DIALSTR "ATDT %s\r"    /* printf format for modem dial command */
  2465. X/*#define DIALSTR "AAATDT%s\r"    /* printf format for older Telebits */
  2466. X
  2467. X/* DTR_DROPS_CARRIER
  2468. X    On some (most?) modems, dropping the DTR signal will instruct the modem
  2469. X    to disconnect the phone line. On most (some?) Unix systems, setting a
  2470. X    bit/second rate of 0 will drop carrier.
  2471. X
  2472. X    If either of these conditions do NOT apply to your setup, set this value to
  2473. X    0 and an alternate hangup function will be used. This alternate function
  2474. X    sends the modem the ATTEN string, waits a few seconds, and then sends the
  2475. X    HANGUP string, so check if those are correct for your modem.
  2476. X*/
  2477. X#define    DTR_DROPS_CARRIER    {{DTR_DROPS_CARRIER}}
  2478. X#if !DTR_DROPS_CARRIER        /* If not, then we need the next two defines */
  2479. X# define ATTEN "+++"        /* Modem "attention" signal */
  2480. X# define HANGUP "ATH\r"        /* Modem "hang up" command */
  2481. X#endif
  2482. X
  2483. X/* DEBUG
  2484. X    If this manifest is set to 1, then whenever XC is run within a
  2485. X    directory that contains a file called "debug.log", XC will append to
  2486. X    that file a copy of all XC output, whether to the terminal "file" or
  2487. X    to standard error. This can be useful for debugging scripts, coupled
  2488. X    with the "debug" script command, which causes the lines of a script
  2489. X    to be echoed to the terminal as they get executed. Since often such
  2490. X    output passes up the terminal screen too quickly to read, the
  2491. X    "debug.log" file provides a hard-copy of the XC session.
  2492. X    No echoing to a "debug.log" file is done if XC is also capturing
  2493. X    incoming text to a capture file. If no "debug.log" file exists in the
  2494. X    current directory, then no such echoing is done regardless of whether
  2495. X    the DEBUG is here defined as 0 or 1.
  2496. X*/
  2497. X#define DEBUG    {{DEBUG}}
  2498. X#if DEBUG && !NODEBUG
  2499. X# define fprintf Fprintf
  2500. X# define fputc Fputc
  2501. X# define fputs Fputs
  2502. X#endif
  2503. X
  2504. X/* NOSHELL
  2505. X    Set this to 1 to disallow shell escapes. Both the "!" and "$" mechanisms
  2506. X    from the XC prompt, and the analogous SHELL and PIPE keywords in scripts,
  2507. X    silently do nothing. However the standard output of backquoted shell
  2508. X    commands can still be assigned to a script variable.
  2509. X*/
  2510. X#define NOSHELL    {{NOSHELL}}
  2511. X
  2512. X/* For XC, the following definitions are significant:
  2513. X    DIDO=0
  2514. X        This will not include any of the LCK..file code respected by cu/uucp.
  2515. X
  2516. X    DIDO=2
  2517. X    DIDO=3
  2518. X    DIDO=4
  2519. X        For a Dial-In/Dial-Out port.
  2520. X
  2521. X        2 is for SCO Xenix 2.2 which uses ungetty.
  2522. X        3 is for SCO Xenix 2.3 whose getty is effectively a uugetty,
  2523. X          for SCO Unix, or for other sites using uugetty.
  2524. X        4 is for Unix Sys V Release 4
  2525. X*/
  2526. X#define DIDO    {{DIDO}}
  2527. X
  2528. X/* Local Unix peculiarities */
  2529. X
  2530. X/*    STRCHR and STRRCHR vs. INDEX and RINDEX
  2531. X    Some Berkely and Xenix systems have index() and rindex() which are
  2532. X    functionally identical to the more standard strchr() and strrchr()
  2533. X    functions. These two defines should be 0 if your Unix uses index and
  2534. X    rindex instead of strchr and strrchr.
  2535. X*/
  2536. X#define    HAVE_STRCHR        {{HAVE_STRCHR}}
  2537. X#define    HAVE_STRRCHR    {{HAVE_STRCHR}}
  2538. X#if !HAVE_STRCHR
  2539. X# define    strchr    index
  2540. X#endif
  2541. X#if !HAVE_STRRCHR
  2542. X# define    strrchr    rindex
  2543. X#endif
  2544. X
  2545. X/*    DUP2
  2546. X    dup2() is not included with all versions of Unix. If your implementation
  2547. X    does not have dup2() (or if you are just not sure), define this as 0 and a
  2548. X    functional equivalent will be included in the source code.
  2549. X*/
  2550. X#define    DUP2    {{HAVE_DUP2}}
  2551. X
  2552. X/*    STRSTR
  2553. X    The draft Ansi C standard specifies the "strstr" function to return the
  2554. X    position of a substring within a string. This is NOT included in many Unix
  2555. X    systems, so code for this function is included unless you define this as 1.
  2556. X*/
  2557. X#define    STRSTR    {{HAVE_STRSTR}}
  2558. X#if !STRSTR
  2559. X extern char *strstr();
  2560. X#endif
  2561. X
  2562. X/*    MEMSET
  2563. X    This function is not on earlier implementations of Unix. Define this as 0
  2564. X    if you don't have it; making it 1 will not include our equivalent code.
  2565. X*/
  2566. X#define MEMSET    {{HAVE_MEMSET}}
  2567. X
  2568. X/*    STRDUP
  2569. X    Again, a function not present on earlier versions of Unix, and again,
  2570. X    defining this as 0 will thereby include our functional equivalent.
  2571. X*/
  2572. X#define STRDUP    {{HAVE_STRDUP}}
  2573. X#if !STRDUP
  2574. X extern char *strdup();
  2575. X#endif
  2576. X
  2577. X/* If you don't have these typedefs in your /usr/include/sys/types.h, then
  2578. X   the following should be 0.
  2579. X*/
  2580. X#define    HAVE_USHORT    {{HAVE_USHORT}}
  2581. X#define    HAVE_UNCHAR    {{HAVE_UNCHAR}}
  2582. X#define    HAVE_ULONG    {{HAVE_ULONG}}
  2583. X#define    HAVE_PID_T    {{HAVE_PID_T}}
  2584. X
  2585. X#if !HAVE_USHORT
  2586. X typedef unsigned short ushort;
  2587. X#endif
  2588. X#if !HAVE_UNCHAR
  2589. X typedef unsigned char unchar;
  2590. X#endif
  2591. X#if !HAVE_ULONG
  2592. X typedef unsigned long ulong;
  2593. X#endif
  2594. X#if !HAVE_PID_T
  2595. X typedef short pid_t;
  2596. X#endif
  2597. X
  2598. X
  2599. X/* The reader is kindly invited to leave the rest of this just as it is! */
  2600. X
  2601. X#define SOH        0x1        /* ^A */
  2602. X#define ETX        0x3        /* ^C */
  2603. X#define EOT        0x4        /* ^D */
  2604. X#define ENQ        0x5        /* ^E */
  2605. X#define ACK        0x6        /* ^F */
  2606. X#define DLE        0x10    /* ^P */
  2607. X#define XON        0x11    /* ^Q */
  2608. X#define XOFF    0x13    /* ^S */
  2609. X#define NAK         0x15    /* ^U */
  2610. X#define CAN        0x18    /* ^X */
  2611. X
  2612. X#ifndef TRUE
  2613. X# define TRUE    1
  2614. X# define FALSE    0
  2615. X#endif
  2616. X#define SUCCESS    1
  2617. X#define FAILURE    0
  2618. X
  2619. X#define NEWMODE    0
  2620. X#define SIGMODE    1
  2621. X#define OLDMODE    2
  2622. X
  2623. X#ifdef toupper
  2624. X# undef toupper
  2625. X# undef tolower
  2626. X#endif
  2627. X
  2628. X#define SM_BUFF     256
  2629. X#define LG_BUFF 2048
  2630. X#define S        show(1,Msg)
  2631. X#define S0(x)    show(0,x)
  2632. X#define S1(x)    show(1,x)
  2633. X#define S2(x)    show(2,x)
  2634. X
  2635. X/*    I prefer this NIL macro to present a NIL pointer than most other
  2636. X    variations that I have seen (eg, NULL, 0, or (cast) 0.
  2637. X    Comme ci, comme ca. - larry gensch
  2638. X*/
  2639. X#ifndef NIL
  2640. X# define    NIL(type)    (type *) 0
  2641. X#endif
  2642. X
  2643. X/* globals in three or more files */
  2644. X
  2645. extern int        CO, LI, my_escape, beep(), hangup(), show_bindings(), cbaud;
  2646. extern short    capture, cismode, flowflag, linkflag, reterm;
  2647. extern char        captfile[], ddsname[], phonefile[], *mport(), word[],
  2648. X                *wptr, line[], Msg[], *lptr, Name[], *getenv(), *unctrl(),
  2649. X                protocol[];
  2650. extern unsigned    mrate(), sleep();
  2651. extern unchar    BS, LK;
  2652. extern ushort    getuid(), getgid(), geteuid(), getegid();
  2653. extern void        cls(), cur_on(), cur_off(), default_bindings(), do_script(),
  2654. X                drawline(), exit(), free(), getline(), getword(), mode(),
  2655. X                lc_word(), msecs(), purge(), send_mbyte(), send_string(),
  2656. X                sendbyte(), show(), show_abort(), ttgoto(), xc_setflow();
  2657. extern FILE        *tfp,            /* the local terminal */
  2658. X                *openfile(), *QueryCreate();
  2659. extern struct    termio oldmode, newmode, sigmode;
  2660. X
  2661. typedef enum {
  2662. X    ENDCHAR = 128,        /* Higher than any valid keyboard code */
  2663. X    CAPTYES,
  2664. X    CAPTEND,
  2665. X    DIVCHAR,
  2666. X    DIALCHR,
  2667. X    HUPCHAR,
  2668. X    SCRPCHR,
  2669. X    BRKCHAR,
  2670. X    HLPCHAR,
  2671. X    QUITCHR,
  2672. X    EMITSTR,
  2673. X    DOSCRPT,
  2674. X    BADFUNC = 0
  2675. X} bindfunc_t;
  2676. END_OF_FILE
  2677. if test 7656 -ne `wc -c <'xc.h.in'`; then
  2678.     echo shar: \"'xc.h.in'\" unpacked with wrong size!
  2679. fi
  2680. # end of 'xc.h.in'
  2681. fi
  2682. if test -f 'xcdbglog.c' -a "${1}" != "-c" ; then 
  2683.   echo shar: Will not clobber existing file \"'xcdbglog.c'\"
  2684. else
  2685. echo shar: Extracting \"'xcdbglog.c'\" \(907 characters\)
  2686. sed "s/^X//" >'xcdbglog.c' <<'END_OF_FILE'
  2687. X/*    xcdbglog.c -- debug logging module for XC
  2688. X    This file uses 4-character tabstops
  2689. X*/
  2690. X
  2691. X#include <stdio.h>
  2692. X#include <time.h>
  2693. X#include <sys/types.h>
  2694. X#define NODEBUG 1    /* prevents xc.h from defining DEBUG */
  2695. X#include "xc.h"
  2696. X
  2697. X#if DEBUG
  2698. static FILE *dfp;
  2699. X
  2700. void
  2701. dbglog()
  2702. X{
  2703. X    long todnow;
  2704. X
  2705. X    time(&todnow);
  2706. X    if (!access("debug.log",0) && (dfp=fopen("debug.log","w")))
  2707. X        setbuf(dfp, NIL(char)),
  2708. X        fprintf(dfp,(char*)asctime(localtime(&todnow)));
  2709. X    return;
  2710. X}
  2711. X
  2712. XFputc(c, stream)
  2713. register c;
  2714. XFILE *stream;
  2715. X{
  2716. X    if (!capture && dfp && c != '\r')
  2717. X        fputc(c,dfp);
  2718. X    return(fputc(c,stream));
  2719. X}
  2720. X
  2721. XFputs(s, stream)
  2722. register char *s;
  2723. XFILE *stream;
  2724. X{
  2725. X    if (!capture && dfp)
  2726. X        fputs(s,dfp);
  2727. X    return(fputs(s,stream));
  2728. X}
  2729. X
  2730. XFprintf(stream, format, a, b, c, d, e, f, g)
  2731. XFILE *stream;
  2732. char *format;
  2733. long a, b, c, d, e, f, g;
  2734. X{
  2735. X    if (!capture && dfp)
  2736. X        fprintf(dfp,format,a,b,c,d,e,f,g);
  2737. X    return(fprintf(stream,format,a,b,c,d,e,f,g));
  2738. X}
  2739. X
  2740. X#endif
  2741. END_OF_FILE
  2742. if test 907 -ne `wc -c <'xcdbglog.c'`; then
  2743.     echo shar: \"'xcdbglog.c'\" unpacked with wrong size!
  2744. fi
  2745. # end of 'xcdbglog.c'
  2746. fi
  2747. if test -f 'xcdial.c' -a "${1}" != "-c" ; then 
  2748.   echo shar: Will not clobber existing file \"'xcdial.c'\"
  2749. else
  2750. echo shar: Extracting \"'xcdial.c'\" \(6654 characters\)
  2751. sed "s/^X//" >'xcdial.c' <<'END_OF_FILE'
  2752. X/*    xcdial.c -- dialing directory module for XC
  2753. X    This file uses 4-character tabstops
  2754. X    Author: Steve Manes 8/26/88
  2755. X */
  2756. X
  2757. X#include <stdio.h>
  2758. X#include <string.h>
  2759. X#include <ctype.h>
  2760. X#include <sys/types.h>
  2761. X#include <termio.h>
  2762. X#include <fcntl.h>
  2763. X#include "xc.h"
  2764. X
  2765. X#define NAME    25    /* display for system name */
  2766. X#define NUMBER    22    /*      "        "  phone number */
  2767. X#define BPS          5    /*      "        "  speed */
  2768. X#define PROTO     3    /*      "        "  protocol */
  2769. X#define SCRIPT    14    /*      "        "  script name */
  2770. X
  2771. static FILE *dirf;
  2772. static long pages[57];    /* offsets into phonefile */
  2773. static short dirnum, thispage, lastpage;
  2774. static char *last_nbr = NIL(char);
  2775. static char format[46];
  2776. extern short s_flag;
  2777. extern void cl_end(), newbmask();
  2778. X
  2779. struct {
  2780. X    char *speed;
  2781. X} speed[] = {
  2782. X    "300",
  2783. X    "600",
  2784. X    "1200",
  2785. X    "2400",
  2786. X    "4800",
  2787. X    "9600",
  2788. X#ifdef B19200
  2789. X    "19200",
  2790. X#endif
  2791. X#ifdef B38400
  2792. X    "38400",
  2793. X    "57600",
  2794. X#endif
  2795. X    NIL(char)
  2796. X};
  2797. X
  2798. struct {
  2799. X    char *proto;
  2800. X} proto[] = {
  2801. X    "8N1",
  2802. X    "7E2",
  2803. X    "7O2",
  2804. X    NIL(char)
  2805. X};
  2806. X
  2807. X/*    show a single, formatted dialdir entry.
  2808. X    check its format integrity as we go
  2809. X*/
  2810. static void 
  2811. showentry(choice, entry)
  2812. short choice;
  2813. char *entry;
  2814. X{
  2815. X    char name[NAME +1], num[NUMBER +1],
  2816. X        bps[BPS +1], prot[PROTO+1], script[SCRIPT +1];
  2817. X    char *s;
  2818. X    int i, j;
  2819. X
  2820. X    s = entry;
  2821. X
  2822. X    /* get phone number */
  2823. X    while (isspace(*s))
  2824. X        s++;
  2825. X
  2826. X    for (i=0; i < NUMBER && !isspace(*s); i++, s++)
  2827. X        num[i] = *s;
  2828. X    num[i]='\0';
  2829. X
  2830. X    /* get name */
  2831. X    while (!isspace(*s))
  2832. X        s++;
  2833. X    while (isspace(*s))
  2834. X        s++;
  2835. X    for (i=0; i < NAME && *s != '\t' && *s != '\n'; i++, s++)
  2836. X        name[i] = *s;
  2837. X    name[i] = '\0';
  2838. X
  2839. X    /* get bps */
  2840. X    memset(bps,0,BPS+1);
  2841. X    if (s = strstr(entry, "BPS=")){
  2842. X        s += 4;
  2843. X        for (i=0; i < BPS && isdigit(*s); i++, s++)
  2844. X            bps[i] = *s;
  2845. X        for (i = 0, j = 0 ; speed[i].speed ; i++)
  2846. X                if (!strcmp(bps,speed[i].speed))
  2847. X                    j++;
  2848. X        if (!j){
  2849. X            beep();
  2850. X            sprintf(Msg,"Invalid BPS= for '%s'",name);
  2851. X            S;
  2852. X            return;
  2853. X        }
  2854. X    }
  2855. X
  2856. X    memset(prot,0,PROTO+1);
  2857. X    if (s = strstr(entry, "PROTO=")){
  2858. X        s += 6;
  2859. X        for (i=0; i < PROTO && isalnum(*s); i++, s++)
  2860. X            prot[i] = *s;
  2861. X        prot[i]='\0';
  2862. X        uc_word(prot);
  2863. X        for (i=0, j=0; proto[i].proto; i++)
  2864. X            if (!strcmp(prot,proto[i].proto))
  2865. X                j++;
  2866. X        if (!j){
  2867. X            beep();
  2868. X            sprintf(Msg,"Invalid PROT= for '%s'",name);
  2869. X            S;
  2870. X            return;
  2871. X        }
  2872. X    }
  2873. X
  2874. X    memset(script,0, SCRIPT+1);
  2875. X    if (s = strstr(entry, "SCRIPT=")){
  2876. X        s += 7;
  2877. X        for (i=0; i < SCRIPT && !isspace(*s); i++, s++)
  2878. X            script[i] = *s;
  2879. X    }
  2880. X    fprintf(tfp, format, choice, name, num, script, bps, prot);
  2881. X}
  2882. X
  2883. X/* scroll directory at current filepos */
  2884. static void
  2885. scroll_dir()
  2886. X{
  2887. X    short i;
  2888. X    char buf[120];
  2889. X
  2890. X    mode(OLDMODE);
  2891. X    ttgoto(4, 0);
  2892. X    cur_off();
  2893. X    cl_end();
  2894. X
  2895. X    fseek(dirf, pages[thispage], 0),
  2896. X    dirnum = thispage * (LI - 6);
  2897. X    for (i=0; i < LI - 6; i++){
  2898. X        if (!fgets(buf, 120, dirf)){
  2899. X            lastpage = thispage;
  2900. X            break;
  2901. X        }
  2902. X        showentry(++dirnum, buf);
  2903. X    }
  2904. X
  2905. X    pages[thispage + 1] = ftell(dirf);
  2906. X    if (!fgets(buf, 120, dirf))
  2907. X        lastpage = thispage;
  2908. X    cur_on();
  2909. X    mode(NEWMODE);
  2910. X}
  2911. X
  2912. X/* Dial a phone number, using proper format and delay. */
  2913. void
  2914. xcdial(s)
  2915. char *s;
  2916. X{
  2917. X    char buffer[SM_BUFF];
  2918. X
  2919. X    if (last_nbr)
  2920. X        free(last_nbr);
  2921. X
  2922. X    last_nbr = strdup(s);
  2923. X
  2924. X    sprintf(buffer, DIALSTR, s);
  2925. X    send_string(buffer);
  2926. X}
  2927. X
  2928. static
  2929. parse_entry(buf)
  2930. char *buf;
  2931. X{
  2932. X    int i;
  2933. X    char *s, *t, *nbr, bps[BPS+1], prot[PROTO+1];
  2934. X
  2935. X    if (s = strchr(buf,'\n'))
  2936. X        *s = '\0';
  2937. X
  2938. X    if (s = strstr(buf, "BPS=")){
  2939. X        s += 4;
  2940. X        for (i=0; i < BPS && isdigit(*s); i++, s++)
  2941. X            bps[i] = *s;
  2942. X        bps[i]='\0';
  2943. X        if (!mrate(bps)){
  2944. X            S0("Invalid BPS=");
  2945. X            return FAILURE;
  2946. X        }
  2947. X    }
  2948. X
  2949. X    if (s = strstr(buf, "PROTO=")){
  2950. X        s += 6;
  2951. X        for (i=0; i < PROTO && isalnum(*s); i++, s++)
  2952. X            prot[i] = *s;
  2953. X        prot[i]='\0';
  2954. X        uc_word(prot);
  2955. X        if (!xc_setproto(prot)){
  2956. X            S0("Invalid PROTO=");
  2957. X            return FAILURE;
  2958. X        }
  2959. X    }
  2960. X
  2961. X    cls();
  2962. X    sprintf(Msg,"Calling %s",buf);
  2963. X    S;
  2964. X
  2965. X    if (s = strstr(buf, "PREFIX="))
  2966. X        s += 7,
  2967. X        send_string("\r"),
  2968. X        send_string(s),
  2969. X        send_string("\r"),
  2970. X        s -= 7,
  2971. X        *s = '\0',
  2972. X        sleep(1);
  2973. X
  2974. X    while (isspace(*buf) && *buf)
  2975. X        buf++;
  2976. X
  2977. X    if (!(*buf))
  2978. X        return FAILURE;
  2979. X
  2980. X    for (nbr = buf; !isspace(*buf) && *buf; buf++)
  2981. X        ;
  2982. X
  2983. X    *buf = '\0';
  2984. X    xcdial(nbr);
  2985. X
  2986. X    if (s = strstr(++buf, "SCRIPT=")){
  2987. X        s += 7;
  2988. X        t = s;
  2989. X        while (*t && !isspace(*t))
  2990. X            t++;
  2991. X        *t = '\0';
  2992. X        sprintf(ddsname,"%s",s);
  2993. X        s_flag = linkflag = TRUE;
  2994. X    }
  2995. X    return SUCCESS;
  2996. X}
  2997. X
  2998. static
  2999. dial_entry(choice)
  3000. short choice;
  3001. X{
  3002. X    char buf[120];
  3003. X
  3004. X    if (!choice)
  3005. X        return FAILURE;
  3006. X    rewind(dirf);
  3007. X    while (choice--){
  3008. X        if (!fgets(buf, 120, dirf)){
  3009. X            S0("Nonexistent entry");
  3010. X            return FAILURE;
  3011. X        }
  3012. X    }
  3013. X    return (parse_entry(buf));
  3014. X}
  3015. X
  3016. static
  3017. man_dial()
  3018. X{
  3019. X    ttgoto(LI-1, 0);
  3020. X    cl_end();
  3021. X    fputs("Number to dial: ",tfp);
  3022. X    getline();
  3023. X    if (!line[0])
  3024. X        return FAILURE;
  3025. X    return (parse_entry(line));
  3026. X}
  3027. X
  3028. dial_dir()
  3029. X{
  3030. X    int i, c;
  3031. X    char buf[5];
  3032. X
  3033. X    if (!(dirf = openfile(phonefile))){
  3034. X        sprintf(Msg,"Phonelist '%s' not found",phonefile);
  3035. X        S;
  3036. X        return FAILURE;
  3037. X    }
  3038. X
  3039. X    dirnum = thispage = 0;
  3040. X    lastpage = -1;
  3041. X    cls();
  3042. X    drawline(0, 0, CO);
  3043. X    ttgoto(1,(CO-strlen(phonefile))/2 -1);
  3044. X    show(-1,phonefile);
  3045. X    drawline(2, 0, CO);
  3046. X    ttgoto(3, 0);
  3047. X    sprintf(format,"     %%-%ds %%%ds %%-%ds %%%ds %%%ds%*s\n\r",
  3048. X        NAME, NUMBER, SCRIPT, BPS, PROTO,
  3049. X        CO-NAME-NUMBER-BPS-PROTO-SCRIPT-7, "");
  3050. X    sprintf(Msg, format, "NAME", "NUMBER", "SCRIPT", "BPS", "PRO");
  3051. X    show(-1,Msg);
  3052. X    sprintf(format,"%%3d - %%-%ds %%%ds %%-%ds %%%ds %%%ds\n\r",
  3053. X        NAME, NUMBER, SCRIPT, BPS, PROTO);
  3054. X    scroll_dir();
  3055. X    for (;;){
  3056. X        ttgoto(LI-1, 0);
  3057. X        fputs(
  3058. X        "==>     [#] Dial Entry   [M]anual Dial   [X]it   [N]ext   [P]revious",            tfp);
  3059. X        ttgoto(LI-1, 4);
  3060. X        while (1){
  3061. X            c = toupper(fgetc(stdin));
  3062. X            if (c == BS)
  3063. X                continue;
  3064. X            if (c == 'N' || c == '\n' || c == ' '){
  3065. X                if (thispage > (int)((1000/(LI-6))-1) || thispage == lastpage)
  3066. X                    S0("Last page");
  3067. X                else
  3068. X                    thispage++,
  3069. X                    scroll_dir();
  3070. X                break;
  3071. X            }
  3072. X            else if (c == 'P' && dirnum > 1){
  3073. X                if (!thispage)
  3074. X                    S0("First page");
  3075. X                else
  3076. X                    thispage--,
  3077. X                    scroll_dir();
  3078. X                break;
  3079. X            }
  3080. X            else if (c == 'X'){
  3081. X                cls();
  3082. X                fclose(dirf);
  3083. X                return FAILURE;
  3084. X            }
  3085. X            else if (c == 'M'){
  3086. X                if (man_dial()){
  3087. X                    fclose(dirf);
  3088. X                    reterm = TRUE;
  3089. X                    return SUCCESS;
  3090. X                }
  3091. X                reterm = FALSE;
  3092. X                break;
  3093. X            }
  3094. X            else if (isdigit(c)){
  3095. X                buf[0] = c;
  3096. X                fputc(c,tfp);
  3097. X                for (i=1; i<4; ++i){
  3098. X                    buf[i] = getchar();
  3099. X                    if (buf[i]==BS){
  3100. X                        if (i>0)
  3101. X                            fputs("\b \b",tfp),
  3102. X                            i -= 2;
  3103. X                        else
  3104. X                            i = -1;
  3105. X                        continue;
  3106. X                    }
  3107. X                    fputc(buf[i],tfp);
  3108. X                    if (buf[i]=='\n' || buf[i]=='\r')
  3109. X                        break;
  3110. X                }
  3111. X                if (!i){
  3112. X                    reterm = FALSE;
  3113. X                    break;
  3114. X                }
  3115. X                buf[++i] = '\0';
  3116. X                if (dial_entry(atoi(buf))){
  3117. X                    fclose(dirf);
  3118. X                    reterm = TRUE;
  3119. X                    return SUCCESS;
  3120. X                }
  3121. X                reterm = FALSE;
  3122. X                break;
  3123. X            }
  3124. X        }
  3125. X    }
  3126. X}
  3127. X
  3128. redial()
  3129. X{
  3130. X    char *s;
  3131. X
  3132. X    if (!last_nbr){
  3133. X        S1("REDIAL FAILURE");
  3134. X        return -1;
  3135. X    }
  3136. X
  3137. X    s = strdup(last_nbr);
  3138. X    xcdial(s);
  3139. X    free(s);
  3140. X    return SUCCESS;
  3141. X}
  3142. END_OF_FILE
  3143. if test 6654 -ne `wc -c <'xcdial.c'`; then
  3144.     echo shar: \"'xcdial.c'\" unpacked with wrong size!
  3145. fi
  3146. # end of 'xcdial.c'
  3147. fi
  3148. if test -f 'xcsubs.c' -a "${1}" != "-c" ; then 
  3149.   echo shar: Will not clobber existing file \"'xcsubs.c'\"
  3150. else
  3151. echo shar: Extracting \"'xcsubs.c'\" \(7179 characters\)
  3152. sed "s/^X//" >'xcsubs.c' <<'END_OF_FILE'
  3153. X/*    xcsubs.c -- subroutines for XC
  3154. X    This file uses 4-character tabstops
  3155. X*/
  3156. X
  3157. X#include <stdio.h>
  3158. X#include <string.h>
  3159. X#include <sys/types.h>
  3160. X#include <sys/times.h>
  3161. X#include <sys/param.h>
  3162. X#include <sys/stat.h>
  3163. X#include <ctype.h>
  3164. X#include <signal.h>
  3165. X#include <termio.h>
  3166. X#ifdef T6000
  3167. X#include <sys/ioctl.h>
  3168. X#endif
  3169. X#include <setjmp.h>
  3170. X#include "xc.h"
  3171. X
  3172. extern jmp_buf erret;
  3173. X
  3174. char line[SM_BUFF],    /* Input line */
  3175. X     word[SM_BUFF],    /* Parsed word */
  3176. X     *wptr, *lptr,    /* Word and line pointers */
  3177. X     *tgetstr(), *tgoto();
  3178. int    LI,    /* One less than screen length in termcap entry */
  3179. X    CO;    /* Screen width */
  3180. short ospeed;
  3181. static char tc[LG_BUFF],    /* termcap buffer */
  3182. X            tbuf[LG_BUFF], PC, *CD, *CE, *CF, *CL, *CM, *CN, *SO, *SE;
  3183. X
  3184. void show();
  3185. X
  3186. X#define Tgetstr(code) ((s = tgetstr(code,&p)) ? s : "")
  3187. X
  3188. X#if    !STRSTR        /* For those that do not have strstr() */
  3189. X/*    Find first occurence of str2 in str1 and return a pointer to it */
  3190. char *
  3191. strstr(str1, str2)
  3192. char *str1, *str2;
  3193. X{
  3194. X    register char *Sptr, *Tptr;
  3195. X    int len = strlen(str1) -strlen(str2) + 1;
  3196. X
  3197. X    if (*str2)
  3198. X        for (; len > 0; len--, str1++){
  3199. X            if (*str1 != *str2)
  3200. X                continue;
  3201. X
  3202. X            for (Sptr = str1, Tptr = str2; *Tptr != '\0'; Sptr++, Tptr++)
  3203. X                if (*Sptr != *Tptr)
  3204. X                    break;
  3205. X
  3206. X            if (*Tptr == '\0')
  3207. X                return str1;
  3208. X        }
  3209. X
  3210. X    return NIL(char);
  3211. X}
  3212. X#endif
  3213. X
  3214. X#if !DUP2        /* For those that do not have dup2() */
  3215. X#include <fcntl.h>
  3216. dup2(oldfd, newfd)
  3217. int oldfd, newfd;
  3218. X{
  3219. X    if (fcntl(oldfd, F_GETFL, 0) == -1)        /* Valid file descriptor? */
  3220. X        return (-1);                        /* No, return an error */
  3221. X    close(newfd);                            /* Ensure newfd is closed */
  3222. X    return (fcntl(oldfd, F_DUPFD, newfd));    /* Dup oldfd into newfd */
  3223. X}
  3224. X#endif /* !DUP2    Thanks to Bill Allie CIS: 76703,2061 */
  3225. X
  3226. X#if !STRDUP    /* For those that do not have strdup() */
  3227. char *
  3228. strdup(s)
  3229. char *s;
  3230. X{ return strcpy((char *)malloc(strlen(s)+1), s); }
  3231. X#endif
  3232. X
  3233. X#if !MEMSET        /* For those that do not have memset() */
  3234. char *
  3235. memset(dst, chr, len)
  3236. char *dst;
  3237. register chr, len;
  3238. X{
  3239. X    char *d;
  3240. X    for (d = dst; --len >= 0; *d++ = chr)
  3241. X        ;
  3242. X    return dst;
  3243. X}
  3244. X#endif
  3245. X
  3246. void
  3247. msecs(t)
  3248. long t;
  3249. X{
  3250. X    long start;
  3251. X    struct tms Tbuf;
  3252. X
  3253. X    start = times(&Tbuf);
  3254. X    while ((times(&Tbuf)-start) < (t*HZ)/1000)
  3255. X        ;
  3256. X}
  3257. X
  3258. X/*    Do the fork call, packaging the error return so that the caller
  3259. X    need not have code for it.
  3260. X*/
  3261. forkem()
  3262. X{
  3263. X    int i;
  3264. X
  3265. X    if ((i = fork()) < 0){
  3266. X        S1("XC: Fork failed");
  3267. X        longjmp(erret,1);
  3268. X    }
  3269. X    return i;
  3270. X}
  3271. X
  3272. X/*    Throw away all input characters until no more are sent. */
  3273. void 
  3274. purge(void) { while (readbyte(1) != -1) ; }
  3275. X
  3276. X/*    Line input routine to be used when the raw terminal mode is in effect. */
  3277. void 
  3278. getline()
  3279. X{
  3280. X    int c, i = 0;
  3281. X    char *ptr;
  3282. X
  3283. X    lptr = line;
  3284. X    memset(line, 0, SM_BUFF);
  3285. X
  3286. X    while ((c = getchar()) != '\r' && c != '\n'){
  3287. X        if (c == BS){
  3288. X            if (i > 0){
  3289. X                ptr = unctrl(line[--i]);
  3290. X                line[i] = '\0';
  3291. X                while (*ptr++ != '\0')
  3292. X                    fputs("\b \b",tfp);
  3293. X            } else
  3294. X                beep();
  3295. X            continue;
  3296. X        }
  3297. X        if (c == LK){
  3298. X            while (i > 0){
  3299. X                ptr = unctrl(line[--i]);
  3300. X                while (*ptr++ != '\0')
  3301. X                    fputs("\b \b",tfp);
  3302. X            }
  3303. X            memset(line, 0, SM_BUFF);
  3304. X            continue;
  3305. X        }
  3306. X        if (c == ('v' & 0x1f))
  3307. X            c = getchar();
  3308. X
  3309. X        line[i++] = c;
  3310. X        fputs(unctrl(c), tfp);
  3311. X    }
  3312. X}
  3313. X
  3314. X/*    Parse the "line" array for a word */
  3315. void 
  3316. getword()
  3317. X{
  3318. X    char quote, *ptr = word;
  3319. X    short carat = FALSE, backslash = FALSE;
  3320. X
  3321. X    wptr = lptr;
  3322. X    memset(word, 0, SM_BUFF);
  3323. X
  3324. X    while (isspace(*lptr))
  3325. X        lptr++;
  3326. X
  3327. X    if (*lptr == '\0')
  3328. X        return;
  3329. X
  3330. X    if (*lptr == '\'' || *lptr == '\"')
  3331. X        quote = *lptr++;
  3332. X    else
  3333. X        quote = '\0';
  3334. X
  3335. X    for (; *lptr != '\0'; lptr++){
  3336. X        if (quote){
  3337. X            if (*lptr == '\0'){
  3338. X                word[0] = '\0';
  3339. X                sprintf(Msg,"Unmatched quote: %s", line);
  3340. X                S;
  3341. X                s_exit();
  3342. X            }
  3343. X            if (*lptr == quote)
  3344. X                break;
  3345. X        } else if (!backslash && isspace(*lptr))
  3346. X            break;
  3347. X
  3348. X        if (carat)
  3349. X            *ptr++ = *lptr & 0x1f,
  3350. X            carat = FALSE;
  3351. X        else if (backslash)
  3352. X            *ptr++ = *lptr,
  3353. X            backslash = FALSE;
  3354. X        else if (*lptr == '^')
  3355. X            carat = TRUE;
  3356. X        else if (*lptr == '\\')
  3357. X            backslash = TRUE;
  3358. X        else
  3359. X            *ptr++ = *lptr;
  3360. X    }
  3361. X
  3362. X    lptr++;
  3363. X}
  3364. X
  3365. X/*    Make the specified word all lower case */
  3366. void 
  3367. lc_word(ptr)
  3368. char *ptr;
  3369. X{
  3370. X    while (*ptr){
  3371. X        *ptr = tolower(*ptr);
  3372. X        ptr++;
  3373. X    }
  3374. X}
  3375. X
  3376. X/*    Make the specified word all upper case */
  3377. void uc_word(ptr)
  3378. char *ptr;
  3379. X{
  3380. X    while (*ptr){
  3381. X        *ptr = toupper(*ptr);
  3382. X        ptr++;
  3383. X    }
  3384. X}
  3385. X
  3386. void 
  3387. mode(flag)
  3388. int flag;
  3389. X{
  3390. X    if (flag == NEWMODE)
  3391. X        ioctl(0, TCSETAF, &newmode);
  3392. X    else if (flag == SIGMODE)
  3393. X        ioctl(0, TCSETAF, &sigmode);
  3394. X    else if (flag == OLDMODE)
  3395. X        ioctl(0, TCSETAF, &oldmode);
  3396. X}
  3397. X
  3398. beep()
  3399. X{
  3400. X    putc(7,tfp);
  3401. X    return SUCCESS;
  3402. X}
  3403. X
  3404. X/*    initialize termcap stuff */
  3405. void 
  3406. get_ttype()
  3407. X{
  3408. X    char *ttytype;
  3409. X    char *p = tbuf;
  3410. X    char *s;
  3411. X
  3412. X    if (!(ttytype = getenv("TERM"))){
  3413. X        S1("TERM not set");
  3414. X        exit(6);
  3415. X    }
  3416. X    if (tgetent(tc, ttytype) != 1){
  3417. X        sprintf(Msg,"Can't load %s", ttytype);
  3418. X        S;
  3419. X        exit(7);
  3420. X    }
  3421. X    ospeed = newmode.c_cflag & CBAUD;
  3422. X    LI = tgetnum("li") - 1;
  3423. X    CO = tgetnum("co");
  3424. X    if (!(s=Tgetstr("pc")))
  3425. X        PC = '\0';
  3426. X    else
  3427. X        PC = *s;
  3428. X    
  3429. X    CD = Tgetstr("cd");
  3430. X    CE = Tgetstr("ce");
  3431. X    CL = Tgetstr("cl");
  3432. X    CM = Tgetstr("cm");
  3433. X    SE = Tgetstr("se");
  3434. X    SO = Tgetstr("so");
  3435. X    CF = Tgetstr("CF");
  3436. X    CN = Tgetstr("CN");
  3437. X    if (CF && ! CN)
  3438. X        CN = Tgetstr("CO");
  3439. X}
  3440. X
  3441. X/*    putchr() is a routine to pass to tputs() */
  3442. void
  3443. putchr(int c) { putc(c,tfp); }
  3444. X
  3445. void
  3446. cls(void) { tputs(CL,LI,putchr); }
  3447. X
  3448. void
  3449. cur_on(void) { tputs(CN,1,putchr); }
  3450. X
  3451. void
  3452. cur_off(void) { tputs(CF,1,putchr); }
  3453. X
  3454. void
  3455. cl_line(void) { tputs(CE,1,putchr); }
  3456. X
  3457. void
  3458. cl_end(void) { tputs(CD,LI,putchr); }
  3459. X
  3460. void 
  3461. ttgoto(int row, int col) { tputs(tgoto(CM, col, row),1,putchr); }
  3462. X
  3463. void 
  3464. drawline(row, col, len)
  3465. int row, col, len;
  3466. X{
  3467. X
  3468. X    ttgoto(row, col);
  3469. X    while (len--)
  3470. X        fputc('-', tfp);
  3471. X}
  3472. X
  3473. void 
  3474. show(flag, str)
  3475. short flag;
  3476. char *str;
  3477. X{
  3478. X    if (!flag){
  3479. X        beep();
  3480. X        ttgoto(LI,0),
  3481. X        cl_line(),
  3482. X        ttgoto(LI,(CO-strlen(str))/2 -1);
  3483. X    }
  3484. X    if (flag == 2)
  3485. X        putc('\n',tfp),
  3486. X        putc('\r',tfp);
  3487. X    tputs(SO,1,putchr);
  3488. X    putc(' ',tfp);
  3489. X    fputs(str, tfp);
  3490. X    putc(' ',tfp);
  3491. X    tputs(SE,1,putchr);
  3492. X    if (flag > 0)
  3493. X        putc('\n',tfp),
  3494. X        putc('\r',tfp);
  3495. X}
  3496. X
  3497. void 
  3498. show_abort(void) { S2("USER ABORT"); }
  3499. X
  3500. XFILE *
  3501. isregfile(pathname)
  3502. char *pathname;
  3503. X{
  3504. X    struct stat statbuf;
  3505. X
  3506. X    if (stat(pathname,&statbuf) || (statbuf.st_mode & S_IFMT) != S_IFREG)
  3507. X        return NIL(FILE);
  3508. X    return fopen(pathname, "r");
  3509. X}
  3510. X
  3511. X
  3512. XFILE *
  3513. openfile(name)
  3514. char *name;
  3515. X{
  3516. X    FILE *fp = NIL(FILE);
  3517. X    char *home, fullname[SM_BUFF], *path, *pathend;
  3518. X    int pathlen;
  3519. X
  3520. X    if ((path = getenv("XC_PATH"))){
  3521. X        while (!fp){
  3522. X            if (!(pathend = strchr(path, ':')))
  3523. X                pathlen = strlen(path);
  3524. X            else
  3525. X                pathlen = pathend - path;
  3526. X
  3527. X            sprintf(fullname, "%.*s/%s", pathlen, path, name);
  3528. X            fp = isregfile(fullname);
  3529. X
  3530. X            path += pathlen;
  3531. X            if (*path == '\0')
  3532. X                break;
  3533. X            path++;
  3534. X        }
  3535. X    }
  3536. X
  3537. X    if (!fp)
  3538. X        fp = isregfile(name);
  3539. X    
  3540. X    if (!fp){
  3541. X        if ((home = getenv("HOME")))
  3542. X            sprintf(fullname, "%s/%s", home, name);
  3543. X        fp = isregfile(fullname);
  3544. X    }
  3545. X
  3546. X    if (!fp){
  3547. X        sprintf(fullname, "%s/%s", LIBDIR, name);
  3548. X        fp = isregfile(fullname);
  3549. X    }
  3550. X
  3551. X    return fp;
  3552. X}
  3553. X
  3554. X/*    Translate the character specified by 'c' to its ASCII display name.
  3555. X    Note:    This routine is specific to the ASCII character set.
  3556. X*/
  3557. char *
  3558. unctrl(c)
  3559. int c;
  3560. X{
  3561. X    static char buffer[3], buf1[2];
  3562. X
  3563. X    memset(buffer, 0, 3);
  3564. X    memset(buf1, 0, 2);
  3565. X
  3566. X    if (c == 0x7f)
  3567. X        strcpy(buffer, "^?");
  3568. X    else {
  3569. X        if (iscntrl(c))
  3570. X            strcpy(buffer, "^"),
  3571. X            c += '@';
  3572. X        buf1[0] = c;
  3573. X        strcat(buffer, buf1);
  3574. X    }
  3575. X
  3576. X    return buffer;
  3577. X}
  3578. END_OF_FILE
  3579. if test 7179 -ne `wc -c <'xcsubs.c'`; then
  3580.     echo shar: \"'xcsubs.c'\" unpacked with wrong size!
  3581. fi
  3582. # end of 'xcsubs.c'
  3583. fi
  3584. if test -f 'xcterm.c' -a "${1}" != "-c" ; then 
  3585.   echo shar: Will not clobber existing file \"'xcterm.c'\"
  3586. else
  3587. echo shar: Extracting \"'xcterm.c'\" \(5283 characters\)
  3588. sed "s/^X//" >'xcterm.c' <<'END_OF_FILE'
  3589. X/*    xcterm.c -- terminal mode module for XC
  3590. X    This file uses 4-character tabstops
  3591. X*/
  3592. X
  3593. X#include <stdio.h>
  3594. X#include <sys/types.h>
  3595. X#include <sys/stat.h>
  3596. X#include <ctype.h>
  3597. X#include <signal.h>
  3598. X#include <setjmp.h>
  3599. X#include <termio.h>
  3600. X#include "xc.h"
  3601. X
  3602. char captfile[SM_BUFF] = CAPTFILE,    /* capture file's name */
  3603. X     phonefile[SM_BUFF] = PHFILE,    /* phone number file's name */
  3604. X     ddsname[SM_BUFF];
  3605. XFILE    *cfp;                /* capture file pointer */
  3606. static FILE    *fp;            /* file to transmit */
  3607. static child_pid;            /* ID of child process */
  3608. static jmp_buf rtm, stop;
  3609. static void (*oldvec)();
  3610. short    s_flag, capture = FALSE;
  3611. extern short autoflag, hdplxflag, nl2cr;
  3612. extern get_bound_char();
  3613. X
  3614. X/*  start capturing */
  3615. static void 
  3616. capt_on(junk)
  3617. int junk;
  3618. X{
  3619. X    if (capture)
  3620. X        sprintf(Msg, "Already capturing to \"%s\"", captfile);
  3621. X    else {
  3622. X        if (!(cfp = fopen(captfile, "a")))
  3623. X            sprintf(Msg,"Can't open \"%s\" for capturing",captfile);
  3624. X        else
  3625. X            capture = TRUE,
  3626. X            sprintf(Msg,"Capturing to \"%s\"",captfile),
  3627. X            setbuf(cfp, NIL(char));
  3628. X    }
  3629. X    S2(Msg);
  3630. X
  3631. X    signal(SIGUSR1, capt_on);    /* set signal for next capt_on */
  3632. X}
  3633. X
  3634. X/*  stop capturing */
  3635. static void 
  3636. capt_off(junk)
  3637. int junk;
  3638. X{
  3639. X    if (!capture)
  3640. X        sprintf(Msg,"Sorry, we haven't been capturing lately");
  3641. X    else
  3642. X        fclose(cfp),
  3643. X        capture = FALSE,
  3644. X        sprintf(Msg,"\"%s\" closed for capturing",captfile);
  3645. X
  3646. X    S2(Msg);
  3647. X
  3648. X    signal(SIGUSR2, capt_off);    /* set signal for next capt_off */
  3649. X}
  3650. X
  3651. X/*    cleanup, flush and exit */
  3652. static void 
  3653. cleanup(junk)
  3654. int junk;
  3655. X{
  3656. X    if (capture)
  3657. X        fclose(cfp),
  3658. X        sprintf(Msg,"\"%s\" closed for capturing",captfile),
  3659. X        S2(Msg);
  3660. X
  3661. X    exit(0);
  3662. X}
  3663. X
  3664. static void 
  3665. cisbmode(junk)
  3666. int junk;
  3667. X{
  3668. X    cismode = 2;
  3669. X    signal(SIGCLD, SIG_IGN);
  3670. X    longjmp(rtm,1);
  3671. X}
  3672. X
  3673. static void 
  3674. end_divert(junk)
  3675. int junk;
  3676. X{
  3677. X    show_abort();
  3678. X    fclose(fp);
  3679. X    signal(SIGINT, oldvec);
  3680. X    longjmp(stop,1);
  3681. X}
  3682. X
  3683. X/*    Divert file into input stream, with delay after each newline. */
  3684. void 
  3685. divert(script)
  3686. short script;
  3687. X{
  3688. X    int c;
  3689. X    long i = 1;
  3690. X
  3691. X    if (!script)
  3692. X        fputc('\r',tfp),
  3693. X        fputc('\n',tfp),
  3694. X        show(-1,"File?"),
  3695. X        getline(),
  3696. X        getword();
  3697. X
  3698. X    if (word[0] == '\0')
  3699. X        return;
  3700. X
  3701. X    if (!(fp = fopen(word, "r"))){
  3702. X        sprintf(Msg,"Can't access '%s'",word);
  3703. X        S2(Msg);
  3704. X        return;
  3705. X    }
  3706. X
  3707. X    oldvec = signal(SIGINT,end_divert);
  3708. X    if (setjmp(stop))
  3709. X        return;
  3710. X
  3711. X    while ((c = getc(fp)) != EOF){
  3712. X        if (c != '\n')
  3713. X            sendbyte(c),
  3714. X            i++;
  3715. X        else {
  3716. X            sendbyte(nl2cr ? '\r' : '\n');
  3717. X            /*i = (CBAUD-cbaud)*80 + 4*i + 50; /* season to taste... */
  3718. X            i *= 3;
  3719. X            if (script)
  3720. X                k_waitfor(-i, "");
  3721. X            else
  3722. X                msecs(i);
  3723. X            i = 1;
  3724. X        }
  3725. X    }
  3726. X    fclose(fp);
  3727. X    signal(SIGINT,oldvec);
  3728. X}
  3729. X
  3730. X/*    Select a script file. */
  3731. static 
  3732. get_script()
  3733. X{
  3734. X    fputc('\r',tfp),
  3735. X    fputc('\n',tfp);
  3736. X    show(-1,"Enter script file:");
  3737. X    fputc(' ',tfp);
  3738. X    getline();
  3739. X    if (line[0] == '\0'){
  3740. X        fputc('\r',tfp),
  3741. X        fputc('\n',tfp);
  3742. X        S1("Script file not specified");
  3743. X        return FAILURE;
  3744. X    }
  3745. X    linkflag = FALSE;
  3746. X    getword();
  3747. X    sprintf(ddsname,"%s",word);
  3748. X    return SUCCESS;
  3749. X}
  3750. X
  3751. void 
  3752. terminal(todir)
  3753. short todir;
  3754. X{
  3755. X    register c;
  3756. X    short doneyet_dd = FALSE;
  3757. X
  3758. X
  3759. Reterm:
  3760. X    if (setjmp(rtm) || doneyet_dd)
  3761. X        return;
  3762. X
  3763. X    mode(NEWMODE);
  3764. X    s_flag = FALSE;        /* reset scripting flag */
  3765. X
  3766. X    if (!todir)
  3767. X        sprintf(Msg, "Entering TERMINAL mode - Escape character is '%s'",
  3768. X                       unctrl(my_escape)),
  3769. X        S2(Msg);
  3770. X
  3771. X    /* split into read and write processes */
  3772. X    if ((child_pid = forkem()) == 0){
  3773. X        /* child, read proc: read from port and write to tty */
  3774. X        cfp = NIL(FILE);
  3775. X        if (autoflag && !todir)
  3776. X            capt_on(0);
  3777. X        signal(SIGUSR1, capt_on);
  3778. X        signal(SIGUSR2, capt_off);
  3779. X        signal(SIGTERM, cleanup);
  3780. X
  3781. X        while (1){
  3782. X            while ((c = readbyte(0)) == -1)
  3783. X                ;
  3784. X            if (cismode && c == ENQ)
  3785. X                cleanup(0);
  3786. X
  3787. X            fputc(c,tfp);
  3788. X
  3789. X            if (capture && c != '\r')
  3790. X                fputc(c,cfp);
  3791. X        }
  3792. X        /*NOTREACHED*/
  3793. X    }
  3794. X    /* parent, write proc: read from tty and write to port */
  3795. X    if (cismode)
  3796. X        signal(SIGCLD, cisbmode);
  3797. X
  3798. X    if (todir)
  3799. X        goto dialdir;
  3800. X    do {
  3801. X        switch (c = get_bound_char()){
  3802. X        case CAPTYES:        /* signal child to open capture file */
  3803. X            kill(child_pid, SIGUSR1);
  3804. X            break;
  3805. X
  3806. X        case CAPTEND:        /* signal child to close capture file */
  3807. X            kill(child_pid, SIGUSR2);
  3808. X            break;
  3809. X
  3810. X        case DIVCHAR:        /* divert a file through modem port */
  3811. X            mode(SIGMODE);
  3812. X            divert(FALSE);
  3813. X            mode(NEWMODE);
  3814. X            break;
  3815. X    
  3816. X        case BRKCHAR:
  3817. X            xmitbrk();
  3818. X            break;
  3819. X
  3820. X        case HLPCHAR:
  3821. X            show_bindings();
  3822. X            break;
  3823. X
  3824. X        case SCRPCHR:        /* execute a script file */
  3825. X            if (get_script()==FAILURE)
  3826. X                break;
  3827. X
  3828. X            /* fall through...  */
  3829. X
  3830. X        case DOSCRPT:        /* named script file */
  3831. X            s_flag = TRUE;
  3832. X            goto filicide;
  3833. X
  3834. X        case DIALCHR:        /* select and dial a phone number */
  3835. dialdir:
  3836. X            doneyet_dd = TRUE;
  3837. X            if ((dial_dir()==FAILURE && todir) || s_flag)
  3838. X                goto filicide;
  3839. X            break;
  3840. X
  3841. X        case ENDCHAR:        /* signal child to cleanup and exit */
  3842. filicide:
  3843. X            c = ENDCHAR;
  3844. X            signal(SIGCLD, SIG_IGN);
  3845. X            kill(child_pid, SIGTERM);
  3846. X            break;
  3847. X        
  3848. X        case QUITCHR:
  3849. X            signal(SIGCLD, SIG_IGN);
  3850. X            kill(child_pid, SIGTERM);
  3851. X            s_exit();
  3852. X            break;
  3853. X
  3854. X        case HUPCHAR:        /* Hangup */
  3855. X            hangup();
  3856. X            break;
  3857. X
  3858. X        case '\n':        /* See if NL translation in effect */
  3859. X            if (nl2cr)
  3860. X                c = '\r';
  3861. X
  3862. X        default:    /* just send the character to the port */
  3863. X            sendbyte(c);
  3864. X            if (hdplxflag)
  3865. X                fputc(c,tfp);
  3866. X            break;
  3867. X        }
  3868. X        todir = FALSE;
  3869. X    } while (c != ENDCHAR);
  3870. X
  3871. X    while (wait(NIL(int)) >= 0)    /* wait for the read process to die */
  3872. X        ;
  3873. X
  3874. X    if (s_flag){
  3875. X        mode(SIGMODE);
  3876. X        do_script(ddsname);
  3877. X        goto Reterm;
  3878. X    }
  3879. X
  3880. X    reterm = FALSE;
  3881. X}
  3882. END_OF_FILE
  3883. if test 5283 -ne `wc -c <'xcterm.c'`; then
  3884.     echo shar: \"'xcterm.c'\" unpacked with wrong size!
  3885. fi
  3886. # end of 'xcterm.c'
  3887. fi
  3888. echo shar: End of archive 1 \(of 3\).
  3889. cp /dev/null ark1isdone
  3890. MISSING=""
  3891. for I in 1 2 3 ; do
  3892.     if test ! -f ark${I}isdone ; then
  3893.     MISSING="${MISSING} ${I}"
  3894.     fi
  3895. done
  3896. if test "${MISSING}" = "" ; then
  3897.     echo You have unpacked all 3 archives.
  3898.     rm -f ark[1-9]isdone
  3899. else
  3900.     echo You still need to unpack the following archives:
  3901.     echo "        " ${MISSING}
  3902. fi
  3903. ##  End of shell archive.
  3904. exit 0
  3905.